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.0is the left edge,x: 1.0is the right edgey: 0.0is the top edge,y: 1.0is 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-223
Generate Video
examples/tasks/video-generation-motion.ts:7-234
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 edge0.5= center1.0= right edge
number
required
Vertical position as a normalized value (0.0 to 1.0).
0.0= top edge0.5= center1.0= bottom edge
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
src/decart-video-model.ts:27-28
How Trajectories Are Processed
The trajectory array is serialized to JSON and sent to the API:src/decart-video-model.ts:169-171
Best Practices
Trajectory Planning
Trajectory Planning
- 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
Motion Smoothness
Motion Smoothness
- 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
Coordinate System
Coordinate System
- 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
Performance
Performance
- Motion control videos may take longer to generate
- Increase
pollTimeoutMsfor complex trajectories - Use
lucy-dev-i2vfirst to test trajectory concepts - Complex trajectories don’t necessarily mean better results
Common Patterns
Dynamic Camera Following Subject
Reveal Effect
Dramatic Sweep
Error Handling
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