Jump to content
Search Community

Dynamic pathDataToBezier

mikel test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Since you're constantly changing the path, you'd need to re-parse it and map it on every tick. Here's a fork that shows how you could do that relatively easily in an onUpdate: 

 

There's technically a way you could do it that'd probably be slightly more efficient CPU-wise, but it'd be more complicated code-wise; let me know if you need that. It'd basically involve getting the starting and ending path data, and then using the progress value to interpolate between those. That way, you'd only have to parse the path data twice and then there'd be a simpler (CPU-wise) calculation for the interpolation. But I doubt anybody would notice much of a difference performance-wise unless you're doing a LOT of simultaneous tweens like this. 

 

Happy tweening!

 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...