Skip to content
Sign in
VideoMotion pathMenu

Motion pathPro

Draw the path an object follows over the clip, shape the timing on a cubic bezier graph with draggable handles or presets, and play it along the path at the clip's length.

ProThe husky follows a curve over 5 s and eases out at the end. Press Play to feel the timing.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/motion-path

Usage

tsx
import { MotionPath } from "@/components/ui/chatcn/pro/motion-path"

<MotionPath
  src={startFrame}
  alt="The start frame"
  duration={5}
  points={points}
  onPointsChange={setPoints}
  easing={curve}
  onEasingChange={setCurve}
/>

Click the frame to add points and drag them to shape a smooth curve; the first point is where the object starts. The easing is a CSS cubic bezier [x1, y1, x2, y2], so it can overshoot. Points are frame fractions. samplePath and cubicBezier from @/lib/chatcn-pro-video give the object's position at any moment, the same way the preview does.

Examples

States

No path yet, a custom curve that overshoots, disabled and right to left.

ProNo path yet, a custom curve that overshoots and disabled.

Props

PropTypeNotes
src, altstringRequired. The start frame
aspectRationumberDefault 16 / 9
points, defaultPoints, onPointsChangeVideoPoint[]
easing, defaultEasing, onEasingChangeEasingCurveDefault ease in out
durationnumberPreview length in seconds. Default 5
maxPointsnumberDefault 12
labelsPartial<MotionPathLabels>Every string, for translation
disabled, locale

Keyboard

KeyAction
Add pointAdds a point past the last one and focuses it
Arrow keys on a point or handleMove it by 1%, 5% with Shift
Delete on a pointRemove it
← → on the preview timeScrub

Accessibility

  • Points are buttons named with their place: "Start: Object", "Point 3 of 4".
  • The easing graph is named with its curve, and each handle with its coordinates.
  • Arrow keys move points in screen directions in right to left too; the readouts keep their order.

Motion

  • Play runs the object along the path over the clip with the chosen easing, and a dot rides the easing graph at the same moment, so the curve is felt as well as drawn.
  • Points move with the pointer at once. Under reduced motion Play is off and the scrubber shows any moment instead.