Code

GSAP

MotionPath

Advanced Move elements along arbitrary SVG paths using the MotionPathPlugin. autoRotate tilts the element to follow the curve's tangent. GSAP Docs

🚀
import { MotionPathPlugin } from
  'gsap/MotionPathPlugin';

gsap.registerPlugin(MotionPathPlugin);

// Follow an SVG path — with auto-rotation
gsap.to(rocket, {
  duration: 4,
  ease: 'none',
  repeat: -1,
  motionPath: {
    path: '#mp-curve',     // <path> element
    align: '#mp-curve',    // align origin to path
    alignOrigin: [0.5, 0.5],
    autoRotate: true,      // rotate to follow tangent
  },
});

// Follow a circle path
gsap.to(orb, {
  duration: 3,
  ease: 'none',
  repeat: -1,
  motionPath: {
    path: '#mp-circle',
    align: '#mp-circle',
    alignOrigin: [0.5, 0.5],
  },
});