Most layers need an entrance and an exit. A layer enters from a state and exits to one; vidmake animates between that state and the layer as you wrote it. The shortest form is a preset name:
{ "id": "title", "type": "text", "text": "Hello", "start": "1s", "duration": "3s", "enter": "fadeUp", "exit": "fade" }enter plays at the start of the layer; exit plays so that it finishes exactly at the layer's end.
Both work on every layer type, including groups (the whole group animates as one) and
components.
{ "fonts": [{ "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }], "compositions": [{ "id": "grid", "description": "Twelve presets in, then out, each on its default motion: every tile is the same component with a different preset name", "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea", "layers": [ { "id": "c1", "type": "use", "ref": "tile", "x": 220, "y": 190, "props": { "p": "fade" } }, { "id": "c2", "type": "use", "ref": "tile", "x": 500, "y": 190, "props": { "p": "fadeUp" } }, { "id": "c3", "type": "use", "ref": "tile", "x": 780, "y": 190, "props": { "p": "fadeLeft" } }, { "id": "c4", "type": "use", "ref": "tile", "x": 1060, "y": 190, "props": { "p": "slideUp" } }, { "id": "c5", "type": "use", "ref": "tile", "x": 220, "y": 380, "props": { "p": "scale" } }, { "id": "c6", "type": "use", "ref": "tile", "x": 500, "y": 380, "props": { "p": "pop" } }, { "id": "c7", "type": "use", "ref": "tile", "x": 780, "y": 380, "props": { "p": "zoom" } }, { "id": "c8", "type": "use", "ref": "tile", "x": 1060, "y": 380, "props": { "p": "slideRight" } }, { "id": "c9", "type": "use", "ref": "tile", "x": 220, "y": 570, "props": { "p": "blur" } }, { "id": "c10", "type": "use", "ref": "tile", "x": 500, "y": 570, "props": { "p": "rotate" } }, { "id": "c11", "type": "use", "ref": "tile", "x": 780, "y": 570, "props": { "p": "wipeRight" } }, { "id": "c12", "type": "use", "ref": "tile", "x": 1060, "y": 570, "props": { "p": "typewriter" } } ] }, { "id": "tile", "width": 260, "height": 160, "duration": "4s", "props": { "p": "fade" }, "layers": [ { "id": "slot", "type": "rect", "width": 248, "height": 148, "cornerRadius": 2, "fill": "#e9e4d8", "stroke": "#8a857a", "strokeWidth": 1.5, "dash": [6, 6] }, { "id": "chip", "type": "text", "text": "{{p}}", "font": "Schibsted Grotesk", "fontWeight": 800, "fontSize": 34, "letterSpacing": -1, "fill": "#f4f1ea", "background": "#161412", "padding": 22, "cornerRadius": 2, "start": "0.4s", "end": "3.6s", "enter": "{{p}}", "exit": "{{p}}" } ] }]}Each tile in that demo is the same component with a different preset name passed in
as a prop: "enter": "{{p}}" and the same for exit. Every preset plays on its own
default motion.
#States
A preset is a shortcut for a state. "enter": "fadeUp" on a text layer is the same as
"enter": { "from": { "opacity": 0, "y": "0.3em" } }Write the state yourself when no preset fits. from is where an enter starts; to is where an exit
ends:
"enter": { "from": { "opacity": 0, "y": "0.3em", "blur": "0.15em" }, "motion": "snap", "delay": "0.2s" }"exit": { "to": { "opacity": 0, "scale": 0.96 } }| property | meaning |
|---|---|
opacity | 0..1, multiplies the layer's opacity |
x, y | an offset from the layer's position: px, "%" of the parent, or "em" of the font size |
scale, scaleX, scaleY | multiplies the layer's scale |
rotate | degrees, added to the layer's rotation |
blur | px or "em", added to the layer's blur |
A state lists only what changes. Everything it leaves out stays as written.
#Lengths in em
em lengths scale with the text. "y": "0.3em" is 29 px on a 96 px title and 9 px on a 30 px caption, so
the same entrance looks right at every size. On a layer without a font size, em is 0; use px or %
there.
#Per-property motion
Each property may carry its own motion, so opacity can finish while the move is still settling:
"enter": { "from": { "opacity": 0, "scale": 0.94, "y": { "value": 90, "motion": "bouncy" } } }
{ "fonts": [ { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }, { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk-Italic.ttf" } ], "compositions": [{ "id": "states", "description": "Enter from a state, exit to one: the card fades in on smooth while its y springs on bouncy", "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea", "layers": [ { "id": "card", "type": "group", "width": 600, "height": 320, "start": "0.2s", "end": "3.7s", "enter": { "from": { "opacity": 0, "scale": 0.94, "y": { "value": 90, "motion": "bouncy" } } }, "exit": { "to": { "opacity": 0, "scale": 0.96, "blur": 12 } }, "children": [ { "id": "card-bg", "type": "rect", "cornerRadius": 3, "fill": "#fbf9f4", "stroke": "#161412", "strokeWidth": 2 }, { "id": "card-title", "type": "text", "text": "Shipped", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 120, "letterSpacing": -5.5, "fill": "#161412", "y": 134, "enter": { "from": { "opacity": 0, "y": "0.3em", "blur": "0.15em" }, "motion": "snap", "delay": "0.25s" } }, { "id": "card-sub", "type": "text", "text": "release 0.6 is out", "font": "Schibsted Grotesk", "italic": true, "fontSize": 34, "fill": "#c92a26", "y": 246, "enter": { "type": "fadeUp", "delay": "0.4s" } } ] } ] }]}The card fades and scales on the default smooth motion (0.7 s, no bounce) while its y uses bouncy
and overshoots before it lands. The title inside enters 0.25 s later from a blurred, lowered state on
snap. A per-property object takes value plus motion, duration or ease.
$ vidmake trace presets-states.json -l card --every 3 --to 1.1s
FRAME TIME X Y W H ROT SCALE OPAC NOTES
0 0.00s (not visible)
3 0.10s (not visible)
6 0.20s 640.0 450.0 600.0 320.0 0.0 0.94 0.00 enter:custom
9 0.30s 640.0 413.0 600.0 320.0 0.0 0.96 0.29 enter:custom
12 0.40s 640.0 366.7 600.0 320.0 0.0 0.98 0.63 enter:custom
15 0.50s 640.0 349.0 600.0 320.0 0.0 0.99 0.83 enter:custom
18 0.60s 640.0 351.3 600.0 320.0 0.0 1.00 0.93 enter:custom
21 0.70s 640.0 357.6 600.0 320.0 0.0 1.00 0.97 enter:custom
24 0.80s 640.0 360.8 600.0 320.0 0.0 1.00 0.99 enter:custom
27 0.90s 640.0 360.9 600.0 320.0 0.0 1.00 1.00 enter:custom
30 1.00s 640.0 360.0 600.0 320.0 0.0 1.00 1.00
33 1.10s 640.0 360.0 600.0 320.0 0.0 1.00 1.00#Every preset
| preset | enter starts from | exit ends at | default enter motion |
|---|---|---|---|
fade (aliases fadeIn, fadeOut) | opacity 0 | opacity 0 | smooth |
fadeUp, fadeDown, fadeLeft, fadeRight | opacity 0 and a short offset: 0.3em on text, 32 px on other layers | the same, moving on in that direction | smooth |
slideUp, slideDown, slideLeft, slideRight | off the parent: 100% of its height or width | off the parent | smooth |
rise | text only: each line's glyphs start one line lower, clipped to the line, so they rise from behind it | snap | |
scale | scale 0 | scale 0 | smooth |
pop | scale 0, with an overshoot | scale 0 | bouncy |
zoom | scale 1.2 and transparent | scale 1.2 and transparent | smooth |
blur | transparent with 24 px of blur (0.25em on text) | the same | smooth |
rotate | −25°, scale 0.7, transparent | +25°, scale 0.7, transparent | smooth |
wipeLeft, wipeRight, wipeUp, wipeDown | hidden by a mask: an edge moving in that direction reveals it (wipeRight reveals from left to right) | hidden by an edge moving in that direction | smooth |
typewriter | text only: no characters; they appear one by one | characters disappear from the end | smooth |
Every exit defaults to easeInCubic over 0.4 s: it starts slowly and leaves quickly.
The direction in a preset name is always the direction of motion: slideLeft and fadeLeft move
leftwards, both when entering and when leaving. A top-level slide* starts or ends fully off-screen.
Note
A slide moves the layer within its parent. Inside a group with
"clip": true(or ausecomponent, which clips by default) the layer is cut off at the group's edge, which makes a neat "slide out from under a mask" effect. That's how theslideUpandslideRighttiles above stay inside their slots.
#rise
rise is made for titles. Each line of the text is clipped to its own line box, and the glyphs move up
into it from one line below, so they come out from behind an invisible edge instead of fading in. On its
own, "enter": "rise" raises every line at once. With a stagger the words or lines
rise one after another:
{ "id": "headline", "type": "text", "text": "Ship faster.\nSleep better.", "enter": "rise", "stagger": "word" }
{ "fonts": [ { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }, { "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk-Italic.ttf" } ], "compositions": [{ "id": "stagger", "description": "One text layer each: letters blur in, words rise from behind their line, letters spread from the center", "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea", "layers": [ { "id": "by-char", "type": "text", "text": "Letter by letter", "y": 170, "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 116, "letterSpacing": -5, "fill": "#161412", "stagger": "char", "enter": { "from": { "opacity": 0, "y": "0.3em", "blur": "0.15em" } }, "exit": "fade" }, { "id": "by-word", "type": "text", "text": "then word by word", "y": 340, "font": "Schibsted Grotesk", "italic": true, "fontSize": 104, "letterSpacing": -3, "fill": "#161412", "start": "0.7s", "stagger": "word", "enter": "rise", "exit": "fade" }, { "id": "from-center", "type": "text", "text": "and from the center out", "y": 530, "font": "Schibsted Grotesk", "fontWeight": 800, "fontSize": 64, "letterSpacing": -2.5, "fill": "#c92a26", "start": "1.4s", "stagger": { "by": "char", "from": "center", "over": "0.5s" }, "enter": { "from": { "opacity": 0, "scale": 0.3 }, "motion": "bouncy" }, "exit": "fade" } ] }]}"clip": "line" gives any text entrance the same clipping: { "from": { "y": "100%" }, "clip": "line" }
is rise. In a staggered unit, % is of the line height. rise and clip are errors on layers that
aren't text, on captions, on exit, and inside a stagger's own type (put rise on the layer's enter).
#Options
| field | default | notes |
|---|---|---|
type | a preset name. from / to then adjust it: { "type": "fadeUp", "from": { "blur": 8 } } | |
from | enter only: the state the layer starts from | |
to | exit only: the state the layer ends at | |
motion | enter: the preset's (smooth for most), exit: easeInCubic 0.4 s | a motion name or object: "snap", { "spring": 0.2, "duration": "0.5s" } |
duration, ease | from motion | override the motion's length or curve |
delay | 0 | enter only: wait this long after the layer's start. During the delay the layer stays in its from state. Markers work |
distance | px: how far fade*, slide* and rise move | |
clip | "line" (text): clip each line's glyphs to their line box | |
feather | 0 | wipe* only: px of soft edge |
edge | none | wipe* only: a band of color riding the edge, "#c92a26" or { "color": "#c92a26", "width": 12 } |
An entrance needs a type or a from (an exit, a type or a to). Unknown fields are rejected, to on an
enter is an error, and an unknown type lists every preset.
"enter": { "type": "fadeLeft", "delay": "0.3s", "distance": 120, "motion": "bouncy" }
{ "fonts": [{ "family": "Schibsted Grotesk", "path": "fonts/SchibstedGrotesk.ttf" }], "compositions": [{ "id": "options", "description": "Preset objects: delay staggers the list, distance and motion change the move, duration slows the exit", "width": 1280, "height": 720, "fps": 30, "duration": "4s", "background": "#f4f1ea", "layers": [ { "id": "title", "type": "text", "text": "Release checklist", "font": "Schibsted Grotesk", "fontWeight": 860, "fontSize": 80, "letterSpacing": -3.5, "fill": "#161412", "anchor": "left", "x": 256, "y": 170, "enter": { "type": "fadeDown", "motion": "gentle" }, "exit": { "type": "fade", "duration": "0.8s" } }, { "id": "a", "type": "text", "text": "✓ Validate with no warnings", "font": "Schibsted Grotesk", "fontWeight": 500, "fontSize": 38, "fill": "#4a4640", "anchor": "left", "x": 270, "y": 300, "enter": { "type": "fadeLeft", "delay": "0.3s", "distance": 120, "motion": "bouncy" }, "exit": "fadeRight" }, { "id": "b", "type": "text", "text": "✓ Check the storyboard", "font": "Schibsted Grotesk", "fontWeight": 500, "fontSize": 38, "fill": "#4a4640", "anchor": "left", "x": 270, "y": 380, "enter": { "type": "fadeLeft", "delay": "0.45s", "distance": 120, "motion": "bouncy" }, "exit": "fadeRight" }, { "id": "c", "type": "text", "text": "✓ Render and ship", "font": "Schibsted Grotesk", "fontWeight": 500, "fontSize": 38, "fill": "#4a4640", "anchor": "left", "x": 270, "y": 460, "enter": { "type": "fadeLeft", "delay": "0.6s", "distance": 120, "motion": "bouncy" }, "exit": "fadeRight" }, { "id": "rule", "type": "rect", "anchor": "left", "x": 260, "y": 560, "width": 760, "height": 3, "fill": "#c92a26", "enter": { "type": "wipeRight", "delay": "0.9s", "duration": "1s", "ease": "easeInOutCubic" }, "exit": { "type": "wipeRight", "duration": "0.6s" } } ] }]}In that demo, three list items share the same fadeLeft with a longer distance on the bouncy motion,
and wait for each other with increasing delay. Here is the first one, waiting 0.3 s, then overshooting
past its resting x of 270 and settling:
$ vidmake trace presets-options.json -l a --every 3 --to 1.1s
FRAME TIME X Y W H ROT SCALE OPAC NOTES
0 0.00s 390.0 300.0 498.7 45.6 0.0 1.00 0.00 enter:fadeLeft "✓ Validate with no warnings"
3 0.10s 390.0 300.0 498.7 45.6 0.0 1.00 0.00 enter:fadeLeft "✓ Validate with no warnings"
6 0.20s 390.0 300.0 498.7 45.6 0.0 1.00 0.00 enter:fadeLeft "✓ Validate with no warnings"
9 0.30s 390.0 300.0 498.7 45.6 0.0 1.00 0.00 enter:fadeLeft "✓ Validate with no warnings"
12 0.40s 340.6 300.0 498.7 45.6 0.0 1.00 0.41 enter:fadeLeft "✓ Validate with no warnings"
15 0.50s 278.9 300.0 498.7 45.6 0.0 1.00 0.93 enter:fadeLeft "✓ Validate with no warnings"
18 0.60s 255.4 300.0 498.7 45.6 0.0 1.00 1.00 enter:fadeLeft "✓ Validate with no warnings"
21 0.70s 258.4 300.0 498.7 45.6 0.0 1.00 1.00 enter:fadeLeft "✓ Validate with no warnings"
24 0.80s 266.9 300.0 498.7 45.6 0.0 1.00 1.00 enter:fadeLeft "✓ Validate with no warnings"
27 0.90s 271.0 300.0 498.7 45.6 0.0 1.00 0.99 enter:fadeLeft "✓ Validate with no warnings"
30 1.00s 271.2 300.0 498.7 45.6 0.0 1.00 0.99 enter:fadeLeft "✓ Validate with no warnings"
33 1.10s 270.0 300.0 498.7 45.6 0.0 1.00 1.00 "✓ Validate with no warnings"Notice that its opacity follows the same spring and dips once on the way. Give opacity its own motion
("from": { "opacity": { "value": 0, "motion": "smooth" } }) if that matters.
Tip
Spacing items out with
delayworks, but a group stagger does it for you:"stagger": trueon the group, and the children's entrances start one after another.
Warning
delayonly applies toenter. An exit always ends exactly at the layer's end; to make a layer leave earlier, shorten the layer (durationorend).
#Motion
An entrance without motion uses its preset's default: smooth (a spring with no bounce that settles in
0.7 s) for most, bouncy for pop, snap for rise. Springs start from rest instead of at full
speed, so nothing jumps on the first frame, and they settle exactly at the end of their duration. Redefine smooth in
the project's theme to change every default entrance at once. See
motion tokens for the built-in names and how to write your own.
duration and ease still work and override the motion's: { "type": "fade", "duration": "0.8s" } is
smooth stretched to 0.8 s, and { "type": "fadeUp", "ease": "easeOutBack" } keeps 0.7 s with another
curve.
#Timing
enterruns fromstart + delayuntil its motion settles, in the layer's time.exitruns fromend - durationtoend. A layer withoutduration/endlasts until its parent ends, so its exit plays at the end of the composition (or of its group).- If the layer is shorter than its enter and exit together, both apply at once and their effects multiply.
vidmake timeline shows each layer's window, and vidmake trace names the preset that is active on
each sampled frame in its notes column (enter:fadeUp, exit:fade, enter:custom for a plain state).
Use both to check that an entrance isn't cut short or that two exits line up:
$ vidmake trace presets-options.json -l title --every 4 --from 3s
FRAME TIME X Y W H ROT SCALE OPAC NOTES
90 3.00s 256.0 170.0 662.5 96.0 0.0 1.00 1.00 "Release checklist"
94 3.13s 256.0 170.0 662.5 96.0 0.0 1.00 1.00 "Release checklist"
98 3.27s 256.0 170.0 662.5 96.0 0.0 1.00 1.00 exit:fade "Release checklist"
102 3.40s 256.0 170.0 662.5 96.0 0.0 1.00 0.98 exit:fade "Release checklist"
106 3.53s 256.0 170.0 662.5 96.0 0.0 1.00 0.93 exit:fade "Release checklist"
110 3.67s 256.0 170.0 662.5 96.0 0.0 1.00 0.80 exit:fade "Release checklist"
114 3.80s 256.0 170.0 662.5 96.0 0.0 1.00 0.58 exit:fade "Release checklist"
118 3.93s 256.0 170.0 662.5 96.0 0.0 1.00 0.23 exit:fade "Release checklist"#Presets and your own animation
Entrances and exits are applied on top of the layer's own values rather than replacing them:
opacitymultiplies youropacity.xandyadd an offset to yourx/y.scale,scaleXandscaleYmultiply your scale.rotateadds to yourrotation, andblurto yourblur.typewritermultiplies yourreveal;wipe*clips the layer's box.
So you can keyframe or tween a layer freely and still give it an entrance and an exit. See Combining with presets for a demo.
#From motion.dev
| motion.dev / Framer Motion | vidmake |
|---|---|
initial={{ opacity: 0, y: 24 }} + animate | "enter": { "from": { "opacity": 0, "y": 24 } } |
exit={{ opacity: 0 }} | "exit": { "to": { "opacity": 0 } } |
transition={{ type: "spring", bounce: 0.2, duration: 0.5 }} | "motion": { "spring": 0.2, "duration": "0.5s" } |
per-property transition | "from": { "y": { "value": 24, "motion": "bouncy" } } |
staggerChildren, stagger(0.05, { from: "center" }) | group "stagger": { "each": "50ms", "from": "center" } |
variants | theme motion tokens and presets |