vidmake v0.2.1
Download

Docs/MotionPage 24 / 45

Easing

Every easing curve vidmake understands, from linear to easeOutElastic, plus cubic-bezier(), steps(n), hold, spring(bounce), motion tokens (a curve with a duration, such as smooth, snap and bouncy), and easing functions inside expressions.

View .md Ask Claude Ask ChatGPT

An easing curve maps progress through a segment (0 at its start, 1 at its end) to how far the value has moved. linear moves at a constant speed; easeOutCubic starts fast and slows into place; easeOutBack overshoots and comes back. Curves don't change where an animation starts and ends, only how it gets there.

#Where eases go

placefielddefault
keyframesthird array item or ease on a keyframe object: shapes the segment arriving at that keyframelinear
keys objectease: default for every keyframe without its ownlinear
tweenease, or motioneaseInOut
enter / exit and text staggermotion, or easeenter: the smooth spring (bouncy for pop, snap for rise); exit: easeInCubic
transition (object form)ease, or motioneaseInOut
stagger start timesspreadlinear
expressionseaseOutBack(x) and friends
json
"x": [[0, 100], ["1s", 500, "easeOutCubic"], ["2s", 300, "cubic-bezier(0.8, 0, 0.2, 1)"]]"opacity": { "from": 0, "to": 1, "duration": "0.6s", "ease": "easeOutQuart" }"enter": { "type": "fadeUp", "ease": "easeOutBack" }

Where a field is called motion, it takes a motion: a curve that brings its own duration.

#All easing names

The named curves come in ten families, each with an In, Out and InOut variant:

  • easeIn<Family> starts slowly and accelerates (good for exits).
  • easeOut<Family> starts fast and decelerates (good for entrances: things arrive and settle).
  • easeInOut<Family> is slow at both ends (good for moves between two resting positions).
familycharacternames
SinegentlesteaseInSine easeOutSine easeInOutSine
QuadgentleeaseInQuad easeOutQuad easeInOutQuad
Cubicthe standard UI curveeaseInCubic easeOutCubic easeInOutCubic
QuartstrongereaseInQuart easeOutQuart easeInOutQuart
Quintstronger stilleaseInQuint easeOutQuint easeInOutQuint
Expovery sharp start or stopeaseInExpo easeOutExpo easeInOutExpo
Circquarter-circleeaseInCirc easeOutCirc easeInOutCirc
Backovershoots the target (or backs up first, for In) by about 10%easeInBack easeOutBack easeInOutBack
Elasticrings around the target like a plucked stringeaseInElastic easeOutElastic easeInOutElastic
Bouncebounces off the targeteaseInBounce easeOutBounce easeInOutBounce

Plus these:

namemeaning
linearconstant speed
easesame as easeInOutCubic
easeIn, easeOut, easeInOutthe Cubic variants (easeIn = easeInCubic, ...)
hold (alias step)stays at the start value for the whole segment, then jumps to the end value at the very end
cubic-bezier(x1, y1, x2, y2)a CSS-style cubic Bézier, see below
steps(n)n equal jumps, see below
spring(bounce)a spring that starts from rest and settles exactly at the end of the segment; bounce 0..1, see springs

spring alone means spring(0.25).

Here are nine of them on identical keyframes. Each dot goes out to the right and comes back; the ease sits on both arriving keyframes, so easeInBack backs up before leaving and before returning:

00:00.0 · f 000
Nine easings on the same keyframes: out to the right and back againDownload

Tip

Back, Elastic and Bounce leave the 0..1 range: an easeOutBack on opacity overshoots past 1 and gets clamped, and on width or scale it briefly goes larger than the target. That's usually what you want for position and scale, and rarely what you want for opacity or color.

#cubic-bezier

cubic-bezier(x1, y1, x2, y2) takes the two control points of a Bézier curve from (0, 0) to (1, 1), exactly like CSS. x values should stay within 0..1; y values may go outside it for overshoot. You can paste curves from any CSS easing tool:

json
"ease": "cubic-bezier(0.4, 0, 0.2, 1)""ease": "cubic-bezier(0.34, 1.56, 0.64, 1)"

In keyframes and tweens, the same curve can be written as a four-number array:

json
"x": [[0, 0], ["1s", 800, [0.8, 0, 0.2, 1]]]"y": { "from": 0, "to": 300, "duration": "1s", "ease": [0.4, 0, 0.2, 1] }

#Springs

spring(bounce) is a damped spring squeezed into the segment: spring(0) glides in with no overshoot, spring(0.3) overshoots a little, spring(0.6) rings a few times. Unlike easeOut* curves, which start at full speed, a spring starts from rest (zero speed) and accelerates, so nothing jumps on the first frame. It reaches its target exactly at the end of the segment, so it never runs past a layer or a keyframe.

json
"x": { "from": 0, "to": 600, "duration": "0.6s", "ease": "spring(0.3)" }"y": [[0, 400], ["0.5s", 300, "spring(0.2)"]]

For the physical form (damping, stiffness, mass, as in Remotion), see spring tweens.

#steps and hold

steps(n) divides the segment into n equal steps and jumps at the start of each one, like CSS steps(n): the value is the start value for the first 1/n of the time and reaches the end value only at the end. Use it for ticking clocks, frame-by-frame sprite counters or a deliberately choppy look. Here is the steps(6) row from the demo above, out on the way right:

vidmake trace easing-compare.json -l d8 --every 3 --from 0.3s --to 1.8s
$ vidmake trace easing-compare.json -l d8 --every 3 --from 0.3s --to 1.8s
 FRAME    TIME        X        Y       W       H    ROT  SCALE  OPAC  NOTES
     9   0.30s    490.0    606.0    26.0    26.0    0.0   1.00  1.00  
    12   0.40s    490.0    606.0    26.0    26.0    0.0   1.00  1.00  
    15   0.50s    490.0    606.0    26.0    26.0    0.0   1.00  1.00  
    18   0.60s    595.0    606.0    26.0    26.0    0.0   1.00  1.00  
    21   0.70s    595.0    606.0    26.0    26.0    0.0   1.00  1.00  
    24   0.80s    700.0    606.0    26.0    26.0    0.0   1.00  1.00  
    27   0.90s    700.0    606.0    26.0    26.0    0.0   1.00  1.00  
    30   1.00s    700.0    606.0    26.0    26.0    0.0   1.00  1.00  
    33   1.10s    805.0    606.0    26.0    26.0    0.0   1.00  1.00  
    36   1.20s    805.0    606.0    26.0    26.0    0.0   1.00  1.00  
    39   1.30s    910.0    606.0    26.0    26.0    0.0   1.00  1.00  
    42   1.40s    910.0    606.0    26.0    26.0    0.0   1.00  1.00  
    45   1.50s    910.0    606.0    26.0    26.0    0.0   1.00  1.00  
    48   1.60s   1015.0    606.0    26.0    26.0    0.0   1.00  1.00  
    51   1.70s   1015.0    606.0    26.0    26.0    0.0   1.00  1.00  
    54   1.80s   1120.0    606.0    26.0    26.0    0.0   1.00  1.00

hold is the extreme case: one step. In keyframes, put it on the keyframe you want to jump to:

json
"opacity": [[0, 1], ["1s", 0, "hold"], ["1.5s", 1, "hold"]]

That keeps opacity at 1 until exactly 1 s, at 0 until 1.5 s, then 1 again: a blink with no fade.

#Motion

A motion is a curve with a duration. Entrances, exits, tweens and transitions take one as motion, so the timing of a whole video can come from a few names:

json
"enter": { "type": "fadeUp", "motion": "snap" }"x": { "from": 160, "to": 1120, "motion": "bouncy" }"transition": { "type": "slideLeft", "motion": "gentle" }

vidmake has four built in. All are springs from rest:

namebouncedurationuse
smooth00.7 sthe default entrance
snap0.150.5 squick, a hint of overshoot; the default for rise
bouncy0.450.8 svisible overshoot, for pops and badges; the default for pop
gentle01.2 sslow and soft, for big moves and backgrounds
00:00.0 · f 000
The four built-in motions and a theme motion: each brings its own curve and durationDownload
easing-motion.jsonjson
{  "fonts": [{ "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" }],  "theme": { "motion": { "house": { "ease": "cubic-bezier(0.22, 1, 0.36, 1)", "duration": "0.9s" } } },  "compositions": [{    "id": "motion", "description": "The four built-in motions and a theme motion: each brings its own curve and duration",    "width": 1280, "height": 720, "fps": 30, "duration": "3s", "background": "#f4f1ea",    "layers": [      { "id": "name", "type": "text", "text": "${pick(i, ['smooth · 0.7s', 'snap · 0.5s', 'bouncy · 0.8s', 'gentle · 1.2s', 'house · 0.9s'])}",        "font": "JetBrains Mono", "fontSize": 20, "fill": "#4a4640", "align": "left", "anchor": "left", "x": 140, "y": 140,        "repeat": { "count": 5, "layout": "column", "spacing": 110, "origin": "start" } },      { "id": "smooth", "type": "ellipse", "width": 40, "y": 180, "fill": "#161412",        "x": { "from": 160, "to": 1120, "start": "0.3s", "motion": "smooth" } },      { "id": "snap", "type": "ellipse", "width": 40, "y": 290, "fill": "#161412",        "x": { "from": 160, "to": 1120, "start": "0.3s", "motion": "snap" } },      { "id": "bouncy", "type": "ellipse", "width": 40, "y": 400, "fill": "#161412",        "x": { "from": 160, "to": 1120, "start": "0.3s", "motion": "bouncy" } },      { "id": "gentle", "type": "ellipse", "width": 40, "y": 510, "fill": "#161412",        "x": { "from": 160, "to": 1120, "start": "0.3s", "motion": "gentle" } },      { "id": "house", "type": "ellipse", "width": 40, "y": 620, "fill": "#c92a26",        "x": { "from": 160, "to": 1120, "start": "0.3s", "motion": "house" } }    ]  }]}

#Your own motions

Name motions in the project's theme, under motion:

project.jsonjson
{  "theme": { "motion": {    "house": { "spring": 0.15, "duration": "0.5s" },    "glide": { "ease": [0.22, 1, 0.36, 1], "duration": "0.6s" },    "curve": "cubic-bezier(0.22, 1, 0.36, 1)"  } },  "compositions": [ ... ]}
formmeaning
{ "spring": 0.15, "duration": "0.5s" }a spring with that bounce (0..1), settling at duration. spring also takes true, { "bounce" } or { "damping", "stiffness", "mass" }; without duration it takes 0.6 s (physical springs: their natural settle time)
{ "ease": ..., "duration": "0.6s" }any easing (a name, "cubic-bezier(...)", four numbers or another motion) with a duration
"cubic-bezier(...)", [x1, y1, x2, y2], a namea bare easing with no duration of its own: an entrance keeps its default length, a tween needs duration
  • A motion name works as "motion" on enter, exit, tweens and transitions, and as "ease" anywhere (its curve without the duration).
  • It is also an expression function, which cubic-bezier(...) itself can't be: "width": "=600 * house(clamp(t / 0.5, 0, 1))". The built-in names work too: smooth(x).
  • A theme may redefine a built-in: "smooth": { "spring": 0.1, "duration": "0.6s" } changes every default entrance in the project.
  • Names are letters, digits and _, and must not clash with built-in easings, expression functions or variables; validate says so if they do.
  • A motion object can also be written inline: "motion": { "spring": 0.2, "duration": "0.4s" }, or referenced from anywhere in the theme with "$motion.house".

#Named easings

vidmake 0.5 named curves in a top-level easings object: "easings": { "house": "cubic-bezier(0.22, 1, 0.36, 1)" }. It still works, with a warning; vidmake migrate project.json moves every entry to theme.motion, where a bare easing is a motion without a duration and keeps working the same way.

#Easing functions in expressions

Every easing name is also a function in expressions. It takes a progress value, clamps it to 0..1, and returns the eased value. Combine it with clamp() or map() to turn time into progress:

json
"x": "=200 + 800 * easeOutCubic(t / 1.5)""scale": "=easeOutBack(clamp((t - 0.5) / 0.6, 0, 1))""opacity": "=easeInOutSine(map(t, 1, 2, 0, 1))"

This is the easiest way to give every copy of a repeated layer its own delayed animation, because i is available inside the expression:

00:00.0 · f 000
Easing functions inside expressions: each bar runs easeOutBack on its own staggered clockDownload
easing-expr.jsonjson
{  "compositions": [{    "id": "bars", "description": "Easing functions inside expressions: each bar runs easeOutBack on its own staggered clock",    "width": 1280, "height": 720, "fps": 30, "duration": "3s", "background": "#f4f1ea",    "layers": [      { "id": "base", "type": "rect", "y": 600, "width": 900, "height": 2, "fill": "#161412" },      { "id": "bar", "type": "rect", "width": 70, "anchor": "bottom", "x": 640, "y": 598,        "repeat": { "count": 8, "layout": "row", "spacing": 110 },        "height": "=pick(i, [160, 290, 230, 380, 320, 420, 360, 460]) * easeOutBack(clamp((t - 0.2 - i * 0.08) / 0.7, 0, 1))",        "fill": "=lerp('#d8d1c1', '#161412', i / (n - 1))", "exit": "fade" }    ]  }]}

Each bar computes its own clock: (t - 0.2 - i * 0.08) / 0.7 starts at 0.2 s for the first bar and 0.08 s later for each next one, and easeOutBack turns that clock into an overshooting grow.

Names that work as functions: linear, ease, hold, easeIn, easeOut, easeInOut and every easeIn|Out|InOut<Family> name, the built-in motions (smooth, snap, bouncy, gentle) and your own motions. cubic-bezier(...), steps(n) and spring(bounce) are not available as functions directly; name them in the theme to use them in expressions. step(edge, x) and spring(frame) are different functions with the same names as ease aliases; see Expressions.

For agents

When an ease seems wrong, vidmake trace project.json -l <id> --every 2 shows the real curve as numbers. A typo in an ease name fails validate with the full list of valid names.