Skip to main content
The lucy-motion model enables precise control over camera and subject movement in videos using trajectory points. This is ideal for creating videos with specific motion paths or camera movements.

Overview

Trajectory-based motion control allows you to define keyframes that specify where the subject or camera should be at specific frames. The model interpolates smooth motion between these keyframes.
Trajectories use normalized coordinates (0.0 to 1.0) where:
  • x: 0.0 is the left edge, x: 1.0 is the right edge
  • y: 0.0 is the top edge, y: 1.0 is the bottom edge

Basic Usage

1

Import Dependencies

2

Define Trajectory

Create an array of trajectory points:
Source Reference: src/decart-video-model.ts:18-22
3

Generate Video

Source Reference: examples/tasks/video-generation-motion.ts:7-23
4

Save the Video

Complete Example

Trajectory Configuration

Trajectory Points

Each trajectory point specifies the position at a specific frame:
number
required
Frame number (0-based). Frames beyond the video length will be ignored.
number
required
Horizontal position as a normalized value (0.0 to 1.0).
  • 0.0 = left edge
  • 0.5 = center
  • 1.0 = right edge
number
required
Vertical position as a normalized value (0.0 to 1.0).
  • 0.0 = top edge
  • 0.5 = center
  • 1.0 = bottom edge
Source Reference: src/decart-video-model.ts:22

Example Trajectories

Motion Types

Camera Motion

Create camera pans, zooms, and tracking shots:

Subject Motion

Control subject movement through the frame:

Advanced Configuration

Combining with Other Settings

Direct Orientation Override

Source Reference: src/decart-video-model.ts:27-28

How Trajectories Are Processed

The trajectory array is serialized to JSON and sent to the API:
Source Reference: src/decart-video-model.ts:169-171

Best Practices

  • Start with keyframes: Define key positions first, then add intermediate points for smoothness
  • Spacing matters: More points = smoother motion, but too many can be redundant
  • Frame distribution: Space keyframes evenly for consistent speed, or vary spacing for acceleration/deceleration
  • Test increments: Start with 2-3 keyframes, add more if motion isn’t smooth enough
  • Use at least 3-4 keyframes for complex paths
  • Avoid sudden jumps between consecutive frames
  • Keep position changes gradual between keyframes
  • Test with different frame intervals to find the right balance
  • Remember: (0.5, 0.5) is always the center
  • Use values beyond 0.0-1.0 sparingly (may cause clipping)
  • Consider the aspect ratio when planning diagonal movements
  • Test coordinates visually to ensure they match your intent
  • Motion control videos may take longer to generate
  • Increase pollTimeoutMs for complex trajectories
  • Use lucy-dev-i2v first to test trajectory concepts
  • Complex trajectories don’t necessarily mean better results

Common Patterns

Dynamic Camera Following Subject

Reveal Effect

Dramatic Sweep

Error Handling

Common issues:
  • Invalid trajectory coordinates (outside 0.0-1.0 range)
  • Frame numbers exceeding video length
  • Too few trajectory points for desired motion
  • Generation timeout with complex trajectories

Comparison with Other Models

Next Steps

Image-to-Video

Learn basic image animation

Settings Reference

View all configuration options

Examples

Browse complete working examples

Text-to-Video

Generate videos from text