🌊 spring() — spring simulation
O spring() doesn’t receive an inputRange and outputRange — it simulates physics. Given the current frame and fps, calculates a value that starts at 0 and moves toward 1, goes a little above 1 (overshoot) and then settles. That bounce is what gives the animation life.
🎯 Minimal callout
import { spring, useCurrentFrame, useVideoConfig } from "remotion"; const frame = useCurrentFrame(); const { fps } = useVideoConfig(); // retorna 0 → 1 (com overshoot natural) const progress = spring({ frame, fps }); return <div style={{ transform: `scale(${progress})` }}>Pop!</div>;
📊 spring() vs interpolate() — different outputs
- interpolate: you control every keyframe; movement is predictable and precise.
- spring: you define the physics; movement emerges naturally from the simulation.
- The spring returns a value ≈ 0→1, but can exceed 1 before it settles — that’s the overshoot.
⚙️ config: damping, stiffness, and mass
The spring behavior is adjusted with the object config. Three main parameters: damping (damping), stiffness (stiffness) and mass (weight). Combining all three, you can go from a quick pop to a long, smooth oscillation.
damping — amortization (default: 10)
High (e.g., 200): no overshoot, direct movement like a CSS ease-out. Low (e.g., 5): lots of oscillation, a “trampoline” effect.
stiffness — stiffness (default: 100)
High (e.g., 300): faster, more aggressive movement. Low (e.g., 40): moves more slowly, with a “loose” spring.
mass — weight (default: 1)
High (e.g., 3): “heavy object,” slow movement with more oscillation. Low (e.g., 0.5): lightweight object, resolves quickly.
// Pop rápido sem bounce spring({ frame, fps, config: { damping: 200 } }) // Bounce divertido spring({ frame, fps, config: { damping: 8, stiffness: 120 } }) // Entrada pesada e lenta spring({ frame, fps, config: { damping: 15, stiffness: 60, mass: 2.5 } })
⚖️ spring vs interpolate — when to use each
The two functions serve different purposes. The right choice saves time and makes the video more polished. A simple rule: spring for lively entrances, interpolate for exact timing and fades.
✓ Use spring() when…
- ✓Element "jumps" into position — icon, badge, or entering card.
- ✓You want natural overshoot without manually defining keyframes.
- ✓Scale from 0→1 with bounce (logo appearing).
↔ Use interpolate() when…
- →Fade-in/out with exact timing (you know the right frame).
- →Color, opacity — values that shouldn’t exceed a limit.
- →Animation with multiple keyframes (hold, sequence).
💡 Combine both!
It’s very common to use spring() for the entrance scale and interpolate() for the opacity of the same element — each one where it shines. There's no conflict in calling both in the same component.
⏩ Sequence — scenes with delay and local frame
O <Sequence> is a wrapper that delays the beginning of a child component. With the prop from, the child only starts to exist on the specified frame—and, crucially, the local frame within the child resets to 0 at that point.
import { Sequence } from "remotion"; // Título 1: frame global 0–59 → frame local 0–59 <Sequence from={0} durationInFrames={60}> <Title1 /> // useCurrentFrame() aqui retorna 0..59 </Sequence> // Título 2: começa no frame global 60 → frame local reinicia em 0 <Sequence from={60} durationInFrames={60}> <Title2 /> // useCurrentFrame() aqui também retorna 0..59 </Sequence>
✓ What to DO with Sequence
- ✓Use
fromto delay any component without changing its internal code. - ✓Use
durationInFramesto limit the child’s visibility window. - ✓Reuse the same component in multiple Sequences with different offsets.
✗ What NOT to do
- ✗Use
frame - offsetmanually in the child component — Sequence already does this. - ✗Stop using
durationInFrames: the child stays “alive” forever (visible after its duration). - ✗Confusing the global frame with the local frame — inside a Sequence, the clock resets.
🪟 AbsoluteFill — Layer Stacking
O <AbsoluteFill> is a div that fills 100% of the composition’s width and height, with position: absolute. Stacked with other AbsoluteFills, it creates layers — background, content, overlay — without affecting the layout.
🎯 The three-layer structure
import { AbsoluteFill } from "remotion"; export const Scene = () => ( <> {/* Camada 1 — fundo (z mais baixo) */} <AbsoluteFill style={{ backgroundColor: "#0a0a0a" }} /> {/* Camada 2 — conteúdo principal */} <AbsoluteFill> <div>Título e elementos</div> </AbsoluteFill> {/* Camada 3 — overlay (z mais alto) */} <AbsoluteFill style={{ opacity: 0.15, background: "radial-gradient(...)" }} /> </> );
💡 Order = implicit z-index
In React, sibling elements with position: absolute and even z-index overlap through the order in JSX: the last one stays in front. AbsoluteFills in sequence create a predictable layer stack—explicit z-index isn’t needed in most cases.
🎞️ Series.Sequence — scenes in an automatic queue
With the <Series>, you don’t need to manually calculate the from of each scene. Place children inside <Series.Sequence durationInFrames={N}> and Remotion calculates the offsets automatically. It’s the foundation of any multi-scene Track 4 project.
import { Series } from "remotion"; export const MyVideo = () => ( <Series> {/* Cena 1: frames 0–89 */} <Series.Sequence durationInFrames={90}> <Intro /> </Series.Sequence> {/* Cena 2: frames 90–179 (calculado auto) */} <Series.Sequence durationInFrames={90}> <MainContent /> </Series.Sequence> {/* Cena 3: frames 180–269 */} <Series.Sequence durationInFrames={90}> <Outro /> </Series.Sequence> </Series> );
✓ Advantages of Series
- ✓Offsets are calculated automatically — adding a scene doesn't break the others.
- ✓Each scene gets a local frame reset to 0 — the same logic as Sequence.
- ✓Declarative structure: the order in JSX = the order in the video.
↔ Series vs. manual Sequence
- →Series: linear scenes in sequence—projects with direct cuts.
- →Manual Sequence: overlapping simultaneous layers, precise timing.
- →Real projects usually use both: Series for scenes, Sequence for internal elements.
📌 Module summary
from; local frame resets to 0 inside the child.Next track:
Track 2 — Resources: images, videos, audio, fonts, and external assets in Remotion. You already know the engine; now comes the fuel.