# Remotion API Reference ## Core Hooks ### useCurrentFrame() ```tsx const frame = useCurrentFrame(); ``` Returns current frame (0-indexed). Inside ``, returns relative frame. ### useVideoConfig() ```tsx const { width, height, fps, durationInFrames, id, defaultProps } = useVideoConfig(); ``` ## interpolate() ```tsx interpolate( input: number, inputRange: number[], outputRange: number[], options?: { extrapolateLeft?: 'extend' | 'clamp' | 'identity' | 'wrap', extrapolateRight?: 'extend' | 'clamp' | 'identity' | 'wrap', easing?: (t: number) => number } ): number ``` **Examples:** ```tsx // Basic interpolation interpolate(15, [0, 30], [0, 100]); // 50 // With clamping interpolate(50, [0, 30], [0, 1], { extrapolateRight: 'clamp' }); // 1 // Multiple keyframes interpolate(frame, [0, 20, 40, 60], [0, 1, 1, 0]); // With easing interpolate(frame, [0, 30], [0, 100], { easing: Easing.bezier(0.42, 0, 0.58, 1) }); ``` ## spring() ```tsx spring({ frame: number, fps: number, config?: { damping?: number, // Default: 10 mass?: number, // Default: 1 stiffness?: number, // Default: 100 overshootClamping?: boolean }, from?: number, // Default: 0 to?: number, // Default: 1 durationInFrames?: number, durationRestThreshold?: number, delay?: number, reverse?: boolean }): number ``` **Config presets:** - High bounce: `{ damping: 5, stiffness: 200 }` - No bounce: `{ damping: 20, stiffness: 100, overshootClamping: true }` - Slow: `{ damping: 20, mass: 2 }` ## measureSpring() Get the duration of a spring animation: ```tsx import { measureSpring } from 'remotion'; const duration = measureSpring({ fps: 30, config: { damping: 10 } }); // Returns number of frames until spring settles ``` ## interpolateColors() ```tsx interpolateColors( input: number, inputRange: number[], outputRange: string[], // Hex, rgb(), rgba(), hsl() options?: { extrapolateLeft?, extrapolateRight? } ): string ``` ## Easing ```tsx import { Easing } from 'remotion'; // Basic Easing.linear Easing.ease Easing.quad Easing.cubic // In/Out/InOut variants Easing.in(Easing.quad) Easing.out(Easing.cubic) Easing.inOut(Easing.ease) // Cubic bezier Easing.bezier(x1, y1, x2, y2) // Other Easing.circle Easing.back(s?) // Overshoot Easing.elastic(bounciness?) Easing.bounce Easing.sin Easing.exp Easing.poly(n) // Power of n ``` ## Components ### Composition ```tsx import('./MyComponent')} durationInFrames={150} fps={30} width={1920} height={1080} defaultProps={{ title: 'Hello' }} calculateMetadata={async ({ props }) => ({ durationInFrames: props.items.length * 30, props: { ...props, computed: true } })} /> ``` ### Sequence ```tsx ``` ### Series ```tsx {/* Frames 0-29 */} {/* Frames 25-84 (offset caused overlap) */} ``` ### Loop ```tsx ``` ### AbsoluteFill ```tsx {/* Position: absolute, full width/height */} ``` ### Media Components **Img** (waits for load): ```tsx ``` **Video/Html5Video:** ```tsx