Remotion Rule: Timing
Remotion skill rule: Interpolation curves in Remotion - linear, easing, spring animations. Part of the official Remotion Agent Skill for programmatic video in React.
Agent 可直接安装
这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。
npx -y tokrepo@latest install ee8f13ea-5f67-4a08-ae1d-3366b53e593f --target codex先 dry-run 确认安装计划,再运行此命令。
What it is
This Remotion skill rule covers interpolation and timing in Remotion videos. Remotion renders video frame-by-frame in React, and animations are driven by the current frame number rather than CSS transitions or requestAnimationFrame. You use the interpolate() function to map frame numbers to property values, with configurable easing curves and spring physics.
This rule is part of the official Remotion Agent Skill set. It provides the correct patterns for creating smooth motion, fade effects, and spring-based animations in programmatic video compositions.
Why it saves time or tokens
Getting animation timing right in Remotion requires understanding how interpolate() maps frame ranges to output ranges. Without this skill rule, developers (and AI agents) often produce jerky animations because they use linear interpolation where easing is needed, or miscalculate frame boundaries. This rule provides the correct formulas and patterns upfront, reducing trial-and-error iterations.
How to use
- Import
interpolateanduseCurrentFramefrom theremotionpackage - Map frame ranges to output values using
interpolate(frame, inputRange, outputRange) - Apply easing curves or spring physics for natural-feeling motion
Example
import { useCurrentFrame, interpolate, spring, useVideoConfig } from 'remotion';
import { Easing } from 'remotion';
const MyAnimation = () => {
const frame = useCurrentFrame();
const { fps } = useVideoConfig();
// Linear fade in over 30 frames
const opacity = interpolate(frame, [0, 30], [0, 1], {
extrapolateRight: 'clamp'
});
// Eased slide from left
const translateX = interpolate(frame, [0, 45], [-100, 0], {
easing: Easing.out(Easing.cubic),
extrapolateRight: 'clamp'
});
// Spring animation
const scale = spring({ frame, fps, config: { damping: 12 } });
return (
<div style={{ opacity, transform: `translateX(${translateX}px) scale(${scale})` }}>
Animated content
</div>
);
};
| Function | Use Case |
|---|---|
| interpolate | Map frames to any numeric value |
| spring | Physics-based natural motion |
| Easing.in | Slow start, fast end |
| Easing.out | Fast start, slow end |
| Easing.inOut | Slow start and end |
Related on TokRepo
- AI tools for video — video production skills and tools on TokRepo
- AI tools for design — animation and design tools
Common pitfalls
- Forgetting
extrapolateRight: 'clamp'causes values to keep increasing past the intended range, producing unexpected animation behavior - Using
interpolatewithout easing produces robotic linear motion; addEasing.out(Easing.cubic)for natural deceleration - Spring animations do not have a fixed duration; use
measureSpring()to calculate how many frames a spring animation takes for accurate composition timing
常见问题
interpolate maps frame numbers to output values using mathematical easing curves. You define exact start and end frames. spring simulates physics-based motion with damping and stiffness parameters. Spring animations feel more natural but do not have a fixed end frame. Use interpolate for precise timing and spring for organic motion.
By default, interpolate extrapolates beyond the input range. Set extrapolateLeft and extrapolateRight to 'clamp' to prevent values from going outside the output range. For example, an opacity interpolation should always clamp to prevent values below 0 or above 1.
Yes. Use different input ranges for each phase. For example, fade in on frames 0-30 and slide on frames 30-60. The Sequence component also helps by offsetting child component start frames, letting you compose animations declaratively.
Use the measureSpring() function from Remotion. Pass the same spring config (damping, stiffness, mass) and fps, and it returns the number of frames the spring takes to settle. Use this value to set your Sequence or composition duration accurately.
Remotion provides Easing.linear, Easing.ease, Easing.quad, Easing.cubic, Easing.sin, Easing.exp, Easing.circle, Easing.back, Easing.elastic, and Easing.bounce. Each can be wrapped with Easing.in, Easing.out, or Easing.inOut to control the acceleration pattern.
引用来源 (3)
- Remotion GitHub— Remotion uses frame-based interpolation for video animation
- Remotion Docs— interpolate function maps frame numbers to output values
- Remotion Spring Docs— Spring animations in Remotion use physics-based motion
来源与感谢
Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule:
timing
Part of the Remotion AI Skill collection on TokRepo.
讨论
相关资产
Remotion Rule: Text Animations
Remotion skill rule: Typography and text animation patterns for Remotion.. Part of the official Remotion Agent Skill for programmatic video in React.
Remotion Rule: Trimming
Remotion skill rule: Trimming patterns for Remotion - cut the beginning or end of animations. Part of the official Remotion Agent Skill for programmatic video in React.
Remotion Rule: Lottie
Remotion skill rule: Embedding Lottie animations in Remotion.. Part of the official Remotion Agent Skill for programmatic video in React.
Remotion Rule: Videos
Remotion skill rule: Embedding videos in Remotion - trimming, volume, speed, looping, pitch. Part of the official Remotion Agent Skill for programmatic video in React.