GSAP's BezierPlugin enables you to animate any object along a complex bezier curve. However, it isn't simple for most people to generate the exact coordinates of all the anchor and control points needed to describe a Cubic or Quadratic bezier curve.
MorphSVGPlugin to the rescue
MorphSVGPlugin's main responsibility is morphing SVG paths and in order to do that, it converts SVG path data internally into bezier curves. We thought it would be convenient to allow users to tap into that functionality.
MorphSVGPlugin.pathDataToBezier() converts SVG
<path> data into an array of cubic Bezier points that can be fed into a BezierPlugin tween (basically using it as a motion guide)!
Watch the video
Aren't there other tools that do this?
Sure, you could find some github repos or dusty old WordPress blogs that have some tools that move objects along a path. The problem is, what do you do when you need to incorporate one of these animations with other effects? Before long you're loading 5 different tools from different developers and none of the tools can "talk to each other". Choreographing a complex animation becomes a nightmare.
What happens when you need to pause or reverse an animation from one of these "free" tools? Chances are you'll be spending dozens of hours trying to make it all work.
With GSAP, all our plugins work seamlessly together. Any animation you create using any plugin can be synchronized with hundreds of others.
Suppose your client comes to you with a small project with the following requirements:
- Morph a hippo into an elephant
- Progressively reveal a curved path
- Animate the elephant along the path
- Display captions for each animation
- Make sure you can play, pause, and reverse the entire sequence
Sounds silly, but something like this should be a breeze. How many hours are you going to spend just looking for the tools you need?
With GSAP you can build it all in under an hour, with less than a dozen lines of code.