MotionPathPlugin
MotionPathPlugin is a GSAP plugin that animates an element along an SVG path or a set of x/y points. You hand it a route and it moves the target through every point on that curve over the tween's duration, optionally rotating the element to face the direction it's traveling.
Updated June 30, 2026
How MotionPathPlugin works
You register the plugin once, then pass a motionPath object to any tween. The plugin reads the path, samples it into points, and drives the target's x and y along that curve from the start of the tween to the end. The four options you reach for most are path (the route), align (what to position the element against), alignOrigin (which point of the element rides the path), and autoRotate (turn to face travel direction).
The single most common confusion is align. Without it, the element follows the path's shape but stays anchored to wherever it already sits on the page, so the motion looks correct but lands in the wrong spot. Set align to the same path element and the plugin moves the target onto the path's coordinate space. Pair it with alignOrigin: [0.5, 0.5] so the element's center rides the line instead of its top-left corner.
You don't need an SVG at all. path also accepts an array of points, and curviness controls how tightly the plugin smooths the curve through them. curviness: 0 connects the points with straight segments, curviness: 2 rounds the corners hard.
It's free
import and registerPlugin it, no license. To tune the path-to-element alignment visually during development, register MotionPathHelper and drag the handles in the browser.Use it for
- Moving an element along a curved or looping route (a marker tracing a map line, a dot orbiting a logo)
- Connector animations where something travels a non-straight line between two points
- Decorative objects that drift along a hand-drawn path rather than a straight tween
- Anything that should face the direction it moves (an arrow, a plane, a cursor follower) via
autoRotate - Pairing with ScrollTrigger
scrubso the element walks the path as the user scrolls
Use something else when
- The move is a straight line, animate
xandydirectly. MotionPathPlugin is overhead you don't need for point-to-point - You're drawing the path's stroke rather than moving along it, that's
DrawSVGPlugin - You're morphing one shape into another, that's
MorphSVGPlugin - The element should follow the live cursor instead of a fixed path, use
gsap.quickToonxandy - You only need a CSS keyframe loop on a simple shape, native CSS
offset-pathcovers basic cases without a JS dependency
Used in these Annnimate components
MotionPathPlugin is the fixed-path member of a family Annnimate uses constantly: an element following a trajectory. The components below follow the live cursor path instead of a predefined SVG path, so they reach for gsap.quickTo rather than MotionPathPlugin, but the mental model is the same, a target chasing a route with lag and easing.
- Image Follow List moves a preview image along the cursor's trajectory with
quickTo, with the image lagging behind the pointer. Swap that freeform route for a fixed#pathand you have a MotionPathPlugin animation - Image Trail drops a series of images along the path the cursor draws, the freeform cousin of seeding elements along a MotionPath
Picking the route type
quickTo when the route is the user's live pointer. Same idea, different source for the points.See it running in production
Common questions
- Why is my element offset from the path in MotionPathPlugin?
- Because you didn't set
align. Without it the plugin animates the element along the path's shape but keeps it anchored to its current page position, so it traces the right curve in the wrong place. Setalignto the same path element andalignOrigin: [0.5, 0.5]so the element's center is moved onto the path itself. - How do I make the element rotate to follow the path?
- Set
autoRotate: trueinside themotionPathobject. GSAP reads the tangent of the path at each point and rotates the element so it faces the direction of travel. This is what you want for arrows, planes, or any object that should look like it's heading somewhere rather than sliding sideways. - Can MotionPathPlugin follow a path without an SVG?
- Yes. Pass
pathan array of{ x, y }points instead of an SVG selector, and usecurvinessto control how smoothly the plugin rounds the curve through them.curviness: 0gives straight segments between points, higher values round the corners. You only need an actual SVG<path>when you want to author the route in a vector tool. - MotionPathPlugin vs animating x and y directly?
- If the motion is a straight line from A to B, animate
xandydirectly, MotionPathPlugin adds nothing. Use the plugin when the route is curved, looping, or hand-drawn, or when you want the element to auto-rotate along the tangent. The plugin's job is interpolating along a non-linear path, which a plain x/y tween can't do. - Is MotionPathPlugin free to use commercially?
- Yes. It was a Club GreenSock plugin in the past, but Webflow made GSAP and all former Club plugins free for any use, including commercial, fully live April 30 2025. On GSAP 3.13 and up you import it and call
gsap.registerPlugin(MotionPathPlugin)with no license key.
