Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Add named easing curves and cubic-bezier to keyframes

Nguyen Xuan An541927f1f199
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 16f50ebc..94bdce19 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -48,6 +48,7 @@ These checks need a GPU or a person's eyes, so they do not run on a pull request
| `npm run reference` | Shaders, lighting or materials |
| `npm run benchmark:runtime` | The renderer's frame path |
| `scripts/blender-golden.py` | A case in `tests/fixtures/blender/cases.json`, or the Blender version |
+| `scripts/blender-easing-golden.py` | An easing curve, or the Blender version |
Do not weaken a test to make it pass. If a test is flaky, find the cause and fix the test or the code.
diff --git a/bench/agent-modeling/README.md b/bench/agent-modeling/README.md
index ce77e2b4..78b339bc 100644
--- a/bench/agent-modeling/README.md
+++ b/bench/agent-modeling/README.md
@@ -334,3 +334,7 @@ What did move is Haiku's pass rate on the cabinet: 3/3 with relations in the sta
| Sonnet | off | 0/3 | 8, 7, 8 | 0 | 0 |
Result (measured, 3 runs per cell): branches did not save calls where the task was passed. Haiku made 9 calls in five of six runs with no branch call, and passed with branches on and off. Sonnet used branches in all 3 runs with them on (4 to 5 calls) and finished in 7 calls against 7 to 8 without, but it failed all 6 runs: every run kept "airy", which measures 0.52 (too pale). A one-call lower count for runs that all fail is not a saving. The issue's calls condition is not met. What this shows: the check rejects the plausible wrong pick and Sonnet makes it, so the look judgement is the hard part here, and branches that render the three variants side by side did not lead Sonnet to the right one. What it does not show: whether a different brightness window or a prompt that gives a target picture would change either model's pick. The task was not changed after the runs.
+
+## An overshoot with one easing (2026-11-03, issue #286)
+
+`overshoot-lift` asks for a 0.4 m block that rises from 0.2 m to 1.2 m in 1 s, peaks between 1.25 m and 1.45 m and settles on 1.2 m. The `overshoot` check samples the exported recipe 41 times: the start and end heights within 0.02 m, a peak in the range, and a settle after the peak. The reference uses `easeOutBack` on a `LINEAR` track: 2 keyframes. `EASING_PLAIN_SOLUTION` does the same with plain `SMOOTH` keyframes and needs 3, because the peak and the settle have to be placed by hand (its peak at t = 0.55 and 1.32 m came from trying values until the check passed, which an agent would also need a retry to do). Both pass the check and a recipe without the easing fails it (`tests/agent-modeling-suite.test.js`). Not measured: live agent runs, so the tool call counts of an agent doing the task with and without the easing are still open. Only the keyframe counts are compared here.
diff --git a/bench/agent-modeling/check.mjs b/bench/agent-modeling/check.mjs
index 95dff5e5..843e4bec 100644
--- a/bench/agent-modeling/check.mjs
+++ b/bench/agent-modeling/check.mjs
@@ -47,6 +47,25 @@ function checkWalk(rig, check) {
const WALK_SAMPLES = 41;
// A walker leaves one point to reach another, stays on the ground surface and keeps clear of a round opening.
+/** A node moves along one axis from a start to a target, passes the target and peaks within a range, then settles on it. */
+function checkOvershoot(check, measures) {
+ const axis = AXES[check.axis];
+ const heights = [];
+ for (let sample = 0; sample < WALK_SAMPLES; sample++) {
+ const position = measures.nodePosition(check.node, check.duration * sample / (WALK_SAMPLES - 1));
+ if (!position) return { pass: false, detail: `no drawn node ${check.node}` };
+ heights.push(position[axis]);
+ }
+ const peak = Math.max(...heights);
+ const problems = [];
+ if (Math.abs(heights[0] - check.from) > 0.02) problems.push(`starts at ${round(heights[0])}`);
+ if (Math.abs(heights.at(-1) - check.to) > 0.02) problems.push(`ends at ${round(heights.at(-1))}`);
+ if (peak < check.peak[0] || peak > check.peak[1]) problems.push(`peaks at ${round(peak)}`);
+ const peakIndex = heights.indexOf(peak);
+ if (peakIndex >= heights.length - 2) problems.push('never settles back from its peak');
+ return { pass: problems.length === 0, detail: problems.join('; ') || `peaks at ${round(peak)}, settles on ${check.to}` };
+}
+
function checkWalkPath(check, measures) {
const problems = [];
const planarDistance = (position, target) => Math.hypot(position[0] - target[0], position[2] - target[1]);
@@ -269,6 +288,8 @@ function checkOne(check, measures) {
const relief = bounds.max[1] - bounds.min[1];
return { pass: relief >= check.min && relief <= check.max, detail: `${check.node} spans ${round(relief)} m in height` };
}
+ case 'overshoot':
+ return checkOvershoot(check, measures);
case 'walkPath':
return checkWalkPath(check, measures);
case 'renderedLook': {
diff --git a/bench/agent-modeling/easing.mjs b/bench/agent-modeling/easing.mjs
new file mode 100644
index 00000000..8c3e40db
--- /dev/null
+++ b/bench/agent-modeling/easing.mjs
@@ -0,0 +1,44 @@
+// The overshoot-lift task: a block that rises and settles with an overshoot. A named easing does it in two keyframes;
+// without one the agent has to place the peak and the settle by hand. EASING_PLAIN_SOLUTION is that hand-placed version,
+// kept to compare how many keyframes the same result costs.
+
+const BLOCK_SIZE = 0.4;
+const REST_HEIGHT = 0.2;
+const TARGET_HEIGHT = 1.2;
+const DURATION = 1;
+
+export const EASING_TASKS = [
+ {
+ id: 'overshoot-lift',
+ prompt: `You are working with the 67js MCP tools. Units are metres and Y is up. Build a node named block, a box ${BLOCK_SIZE} m on every side, standing on the ground at X = 0, Z = 0 (its centre ${REST_HEIGHT} m high), with a material.
+Add a ${DURATION} second motion that lifts the block straight up until its centre is ${TARGET_HEIGHT} m high, with an overshoot: on the way up it passes ${TARGET_HEIGHT} m, peaks between 1.25 m and 1.45 m, and settles back to
+exactly ${TARGET_HEIGHT} m by the end of the motion, where it stays. When it is finished, call scene_export_recipe once: the exported recipe is what gets graded.`,
+ ownPreamble: true,
+ checks: [
+ { kind: 'lint' },
+ { kind: 'overshoot', node: 'block', axis: 'y', from: REST_HEIGHT, to: TARGET_HEIGHT, duration: DURATION, peak: [1.25, 1.45] },
+ ],
+ },
+];
+
+function liftRecipe(keyframes, interpolation) {
+ return {
+ format: '67js.scene', schemaVersion: 1,
+ geometries: [{ id: 'body', type: 'box', bevel: 0 }],
+ materials: [{ id: 'steel', color: [0.6, 0.62, 0.65] }],
+ nodes: [{ id: 'block', geometry: 'body', material: 'steel', translation: [0, REST_HEIGHT, 0], scale: [BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE] }],
+ motion: {
+ duration: DURATION,
+ tracks: [{
+ kind: 'node', id: 'block', property: 'translation', interpolation,
+ keyframes: keyframes.map(([time, height, easing]) => ({ time, value: [0, height, 0], ...(easing ? { easing } : {}) })),
+ }],
+ },
+ };
+}
+
+/** Two keyframes and one named easing. */
+export const EASING_SOLUTION = liftRecipe([[0, REST_HEIGHT, 'easeOutBack'], [DURATION, TARGET_HEIGHT]], 'LINEAR');
+
+/** The same motion with plain keyframes: smooth segments through the rise, the peak and the settle. */
+export const EASING_PLAIN_SOLUTION = liftRecipe([[0, REST_HEIGHT], [0.55, 1.32], [DURATION, TARGET_HEIGHT]], 'SMOOTH');
diff --git a/bench/agent-modeling/references.mjs b/bench/agent-modeling/references.mjs
index 4fc666a5..8f35ee2e 100644
--- a/bench/agent-modeling/references.mjs
+++ b/bench/agent-modeling/references.mjs
@@ -13,6 +13,7 @@ import { DUSK_SOLUTION } from './dusk.mjs';
import { COLONNADE_SOLUTION } from './colonnade.mjs';
import { DESK_FINAL, DESK_FINAL_PLAIN } from './desk.mjs';
import { CABINET_FINAL, CABINET_FINAL_PLAIN } from './cabinet.mjs';
+import { EASING_SOLUTION } from './easing.mjs';
const material = [{ id: 'paint', color: [0.6, 0.55, 0.5] }];
@@ -388,6 +389,7 @@ export const REFERENCES = {
],
),
'rigged-walker': walkerRecipe(),
+ 'overshoot-lift': EASING_SOLUTION,
'terrain-hole-walk': {
format: '67js.scene', schemaVersion: 1,
geometries: [
diff --git a/bench/agent-modeling/tasks.mjs b/bench/agent-modeling/tasks.mjs
index b286a257..af3036d6 100644
--- a/bench/agent-modeling/tasks.mjs
+++ b/bench/agent-modeling/tasks.mjs
@@ -10,6 +10,7 @@ import { GALLERY_START, GALLERY_PROMPT, GALLERY_CHECKS } from './gallery.mjs';
import { DUSK_START, DUSK_PROMPT, DUSK_CHECKS } from './dusk.mjs';
import { COLONNADE_START, COLONNADE_PROMPT, COLONNADE_CHECKS } from './colonnade.mjs';
import { TERRAIN_TASKS } from './terrain.mjs';
+import { EASING_TASKS } from './easing.mjs';
export const PROMPT_PREAMBLE = `You are modeling with the 67js MCP tools. Build the object described below as a procedural recipe scene:
start it with scene_create, refine it with mesh_edit, mesh_stack and scene_apply, and look at it with scene_look when
@@ -586,6 +587,7 @@ scene. When it is finished, call scene_export_recipe once: the exported recipe i
},
...LONG_TASKS,
...TERRAIN_TASKS,
+ ...EASING_TASKS,
];
/** The task text an agent receives, with the starting recipe appended when the task changes an existing scene. */
diff --git a/bench/tool-cost-budgets.json b/bench/tool-cost-budgets.json
index 41239fcb..ec9c791d 100644
--- a/bench/tool-cost-budgets.json
+++ b/bench/tool-cost-budgets.json
@@ -1,8 +1,8 @@
{
- "measured": "2026-10-31, from scripts/measure-tool-cost.mjs; raised by 800 total and 150 for scene_apply for branch and labels fields (no new tool); raised by 650 total and 80 for scene_apply for clip layers, bone masks and retargeting through MCP; raised by 20 for scene_create and 20 for the scene_capabilities result after merging the expression language with the material graph; was 373388 schema bytes before shared IDs and recipe references; trimmed after the render-passes merge: material graph, depth of field, motion blur and passes details moved to scene_capabilities, budgets set to the measured value plus 0.5% (total 188267, scene_capabilities result 5167); raised by 95 for scene_apply and 690 for the scene_capabilities result for node relations; curve and text geometry entries shortened to a pointer at scene_capabilities curveText, budgets set to the measured value plus 0.5% (total 189468, scene_capabilities result 6399); then six modifier ops (weld, triangulate, edge_split, smooth, simple_deform, cast) added as one compact schema entry with details in scene_capabilities meshModifiers, entry and mesh_stack description shortened: total 190382 (budget unchanged at 190420), mesh_edit 34216 (budget 34220), scene_capabilities result 7042 (budget 7050); mesh_stack 11682 (budget 11690); after merging imported mesh topology with the modifier ops: raised the total to 190480 (measured 190471), mesh_edit to 34300 (measured 34293) and the scene_capabilities result to 7520 (measured 7512) for imported mesh edits; then cloth (recipe cloth, set-cloth, grid geometry) added with the total unchanged at 190480 (measured 189159): physics descriptions shortened and set-physics now takes the same record reference as set-motion, scene_create raised to 62150 and scene_apply lowered to 44130, scene_capabilities result raised to 8190 (measured 8176) for the cloth details; then particles and hair (recipe `particles`, set-particles) added with the total unchanged at 190480 (measured 189642, scene_create raised to 62350 and scene_apply to 44370 for the recipe particles reference and set-particles): the section is one record reference described in scene_capabilities, so the scene_capabilities result rose to 9570 (measured 9523) for the particle and hair fields; after merging the film timeline (recipe timeline, set-timeline) with particles: total 190719 (budget 190730), scene_create 62464, scene_apply 44620, scene_capabilities result 9902; then the path tracer renderer setting (drop z.int bounds, integers still checked by the job validator): total raised to 190830 (measured 190818); after merging the render limits and light bake with the path tracer: measured total 190013, scene_create raised to 62680 (measured 62667), scene_apply to 44860 (measured 44852) and the scene_capabilities result to 10620 (measured 10613) for the bake section and job size limits; then material layers anisotropy and iridescence (issue #51): the 16 layer fields take one short line each in the schema and their ranges and notes moved to scene_capabilities scene.materialLayers, so the scene_capabilities result rose to 12230 (measured 12168); then the worker bake limit added workerMaxSeconds to the bake limits (result 13361, budget raised to 13370); then the sculpt and shrinkwrap mesh edits (issue #47) with the total unchanged at 190830 (measured 190612): the face rule and tag prefix descriptions shortened (the face rule text repeats in every select field), so mesh_edit rose to 33980 (measured 33960) and mesh_stack fell to 11030 (measured 11014), and the scene_capabilities result rose to 13350 (measured 13338) for the meshSculpt notes; then recipe light links and shadow cascades (issue #52): environment fields added to the shared environment schema with the total unchanged at 190830 (measured 190507) by shortening its descriptions, and the scene_capabilities result raised to 13870 (measured 13865) for lightLinking and shadowCascades; then the nine remaining modifiers (issue #42: screw, skin, wireframe, lattice, curve, hook, wave, weighted_normal, smooth_by_angle) added their notes to meshModifiers and a free modifier record replaced the modifier schema entry, so the schemas shrank and the scene_capabilities result rose to 15900 (measured 15814); path query of scene_inspect (issue #64): one record field of 205 bytes in the scene_inspect schema (total 190732, within its budget) and the navigation notes in scene_capabilities, so the result rose to 14500 (measured 14494); reflection probes (issue #55): the bake.probes line, and the scene_capabilities result raised to 16600 (measured 16541) after merging with main; volumeFog shadowAmbient (issue #165): scene_create raised to 62945 (measured 62940) and scene_apply to 45040 (measured 45037); glTF import line gltfImport (issue #280): the scene_capabilities result raised to 16701 (measured 16681)",
- "schemaTotalBytes": 190830,
+ "measured": "2026-10-31, from scripts/measure-tool-cost.mjs; raised by 800 total and 150 for scene_apply for branch and labels fields (no new tool); raised by 650 total and 80 for scene_apply for clip layers, bone masks and retargeting through MCP; raised by 20 for scene_create and 20 for the scene_capabilities result after merging the expression language with the material graph; was 373388 schema bytes before shared IDs and recipe references; trimmed after the render-passes merge: material graph, depth of field, motion blur and passes details moved to scene_capabilities, budgets set to the measured value plus 0.5% (total 188267, scene_capabilities result 5167); raised by 95 for scene_apply and 690 for the scene_capabilities result for node relations; curve and text geometry entries shortened to a pointer at scene_capabilities curveText, budgets set to the measured value plus 0.5% (total 189468, scene_capabilities result 6399); then six modifier ops (weld, triangulate, edge_split, smooth, simple_deform, cast) added as one compact schema entry with details in scene_capabilities meshModifiers, entry and mesh_stack description shortened: total 190382 (budget unchanged at 190420), mesh_edit 34216 (budget 34220), scene_capabilities result 7042 (budget 7050); mesh_stack 11682 (budget 11690); after merging imported mesh topology with the modifier ops: raised the total to 190480 (measured 190471), mesh_edit to 34300 (measured 34293) and the scene_capabilities result to 7520 (measured 7512) for imported mesh edits; then cloth (recipe cloth, set-cloth, grid geometry) added with the total unchanged at 190480 (measured 189159): physics descriptions shortened and set-physics now takes the same record reference as set-motion, scene_create raised to 62150 and scene_apply lowered to 44130, scene_capabilities result raised to 8190 (measured 8176) for the cloth details; then particles and hair (recipe `particles`, set-particles) added with the total unchanged at 190480 (measured 189642, scene_create raised to 62350 and scene_apply to 44370 for the recipe particles reference and set-particles): the section is one record reference described in scene_capabilities, so the scene_capabilities result rose to 9570 (measured 9523) for the particle and hair fields; after merging the film timeline (recipe timeline, set-timeline) with particles: total 190719 (budget 190730), scene_create 62464, scene_apply 44620, scene_capabilities result 9902; then the path tracer renderer setting (drop z.int bounds, integers still checked by the job validator): total raised to 190830 (measured 190818); after merging the render limits and light bake with the path tracer: measured total 190013, scene_create raised to 62680 (measured 62667), scene_apply to 44860 (measured 44852) and the scene_capabilities result to 10620 (measured 10613) for the bake section and job size limits; then material layers anisotropy and iridescence (issue #51): the 16 layer fields take one short line each in the schema and their ranges and notes moved to scene_capabilities scene.materialLayers, so the scene_capabilities result rose to 12230 (measured 12168); then the worker bake limit added workerMaxSeconds to the bake limits (result 13361, budget raised to 13370); then the sculpt and shrinkwrap mesh edits (issue #47) with the total unchanged at 190830 (measured 190612): the face rule and tag prefix descriptions shortened (the face rule text repeats in every select field), so mesh_edit rose to 33980 (measured 33960) and mesh_stack fell to 11030 (measured 11014), and the scene_capabilities result rose to 13350 (measured 13338) for the meshSculpt notes; then recipe light links and shadow cascades (issue #52): environment fields added to the shared environment schema with the total unchanged at 190830 (measured 190507) by shortening its descriptions, and the scene_capabilities result raised to 13870 (measured 13865) for lightLinking and shadowCascades; then the nine remaining modifiers (issue #42: screw, skin, wireframe, lattice, curve, hook, wave, weighted_normal, smooth_by_angle) added their notes to meshModifiers and a free modifier record replaced the modifier schema entry, so the schemas shrank and the scene_capabilities result rose to 15900 (measured 15814); path query of scene_inspect (issue #64): one record field of 205 bytes in the scene_inspect schema (total 190732, within its budget) and the navigation notes in scene_capabilities, so the result rose to 14500 (measured 14494); reflection probes (issue #55): the bake.probes line, and the scene_capabilities result raised to 16600 (measured 16541) after merging with main; volumeFog shadowAmbient (issue #165): scene_create raised to 62945 (measured 62940) and scene_apply to 45040 (measured 45037); keyframe easing (issue #286): one easing string field in each of the motion track schemas, scene_create raised to 63450 (measured 63444) and the total to 191000 (measured 190994); glTF import line gltfImport (issue #280): the scene_capabilities result raised to 16701 (measured 16681)",
+ "schemaTotalBytes": 191000,
"schemaToolBytes": {
- "scene_create": 62945,
+ "scene_create": 63450,
"scene_apply": 45040,
"mesh_edit": 33980,
"scene_create_asset": 19310,
diff --git a/changes/286.md b/changes/286.md
new file mode 100644
index 00000000..a017eda0
--- /dev/null
+++ b/changes/286.md
@@ -0,0 +1 @@
+- Add named easing curves and `cubic-bezier` to keyframes (closes #286). A `LINEAR` or `SMOOTH` keyframe takes `easing` (`linear`, `cubic-bezier(x1, y1, x2, y2)` or `ease<In|Out|InOut>` + Sine, Quad, Cubic, Quart, Quint, Expo, Circ, Back, Bounce or Elastic) for the segment after it, with arguments for Back and Elastic, such as `easeOutBack(3)` and `easeOutElastic(1.5, 0.4)`. Recipe motion tracks, camera paths and material tracks take it, an unknown name throws an error that lists the valid forms, GLB export bakes eased tracks to linear samples, and every curve matches Blender 5.2 within 1e-4 (`tests/easing.test.js`). New suite task `overshoot-lift`; the Keyframes row of the parity ledger is updated.
diff --git a/docs/agent-motion.md b/docs/agent-motion.md
index 8ab99fb8..e933ff19 100644
--- a/docs/agent-motion.md
+++ b/docs/agent-motion.md
@@ -78,6 +78,23 @@ Quaternion values normalize through the existing animation core.
Quaternion tangents retain their authored values.
Other interpolation modes reject tangents.
+### Easing
+
+A keyframe on a `LINEAR` or `SMOOTH` track takes `easing` for the segment that starts there, so a hit, a settle or an overshoot needs two keyframes instead of several:
+
+```json
+{ "kind": "node", "id": "lid", "property": "translation", "keyframes": [
+ { "time": 0, "value": [0, 0.2, 0], "easing": "easeOutBack" },
+ { "time": 1, "value": [0, 1.2, 0] }
+] }
+```
+
+Values: `linear`, `cubic-bezier(x1, y1, x2, y2)` (x from 0 to 1, y from -4 to 5), or `ease` + `In`, `Out` or `InOut` + `Sine`, `Quad`, `Cubic`, `Quart`, `Quint`, `Expo`, `Circ`, `Back`, `Bounce` or `Elastic`.
+`easeOutBack` is the overshoot and `easeOutBounce` the drop; they match Blender's easings of the same family.
+`easeOutBack(overshoot)` takes 0 to 10 (default 1.70158). `easeOutElastic(amplitude, period)` takes an amplitude of 1 to 10 times the change (default 1) and a period of 0.05 to 2 of the segment (default 0.3, or 0.45 for `easeInOutElastic`); either argument can be left out from the right. Other easings take no arguments.
+An unknown name, a parameter on the wrong family, or easing on `STEP` or `CUBICSPLINE` is an error that says what to use instead.
+Camera and material tracks take the same fields. GLB export bakes an eased track to linear samples.
+
## Inverse kinematics
`motion.ik` computes node rotations from a goal, so a recipe can say where a hand should be without any quaternions. It
diff --git a/docs/animation-curves.md b/docs/animation-curves.md
index 5e333b75..d9f8a780 100644
--- a/docs/animation-curves.md
+++ b/docs/animation-curves.md
@@ -36,6 +36,19 @@ Keyframe rotation values retain the existing normalization behavior. Tangents re
`LINEAR` and `SMOOTH` rotations retain shortest-arc spherical interpolation.
`STEP` holds the preceding keyframe. Endpoints clamp, and looping wraps negative times and exact clip boundaries.
+## Easing
+
+A keyframe on a `LINEAR` or `SMOOTH` track can carry `easing`, which shapes the segment that starts at that keyframe.
+Without it, `LINEAR` is a straight ramp and `SMOOTH` is smoothstep. With it, the easing replaces both.
+The value is `linear`, `cubic-bezier(x1, y1, x2, y2)`, or `ease<In|Out|InOut><Family>`, where Family is `Sine`, `Quad`, `Cubic`, `Quart`, `Quint`, `Expo`, `Circ`, `Back`, `Bounce` or `Elastic`: `easeOutBack`, `easeInOutCubic`, `easeOutBounce`.
+These are Blender's easing types (Sine, Quadratic, Cubic, Quartic, Quintic, Exponential, Circular, Back, Bounce, Elastic) with the CSS names. Every name matches Blender 5.2 within 1e-4 at 20 sample times (`tests/easing.test.js`, `scripts/blender-easing-golden.py`).
+An unknown name throws a `RangeError` that lists the valid forms and suggests the right case.
+
+`cubic-bezier` follows CSS: `x1` and `x2` stay in 0 to 1, `y1` and `y2` may leave 0 to 1 (from -4 to 5) to overshoot.
+`easeInBack`, `easeOutBack` and `easeInOutBack` take an overshoot as `easeOutBack(3)` (0 to 10, default 1.70158). The Elastic easings take an amplitude and a period as `easeOutElastic(1.5, 0.4)`: the amplitude is a multiple of the change (1 to 10, default 1) and the period a fraction of the segment (0.05 to 2, default 0.3, or 0.45 for in-out). Blender stores both in absolute units, which are these numbers over a one-unit change in one frame. Arguments on any other easing throw.
+Easing on `STEP` or `CUBICSPLINE` tracks throws. Rotations ease the slerp angle. Easing on the last keyframe is accepted and has no effect.
+Camera channels and material tracks take the same fields. glTF has no easing, so GLB export writes an eased track as 32 linear samples per segment.
+
## Output constraints
Spline overshoot clamps emission to zero or greater and metallic to `[0, 1]`.
diff --git a/docs/camera-path.md b/docs/camera-path.md
index a329bd64..bae34ad2 100644
--- a/docs/camera-path.md
+++ b/docs/camera-path.md
@@ -32,6 +32,7 @@ renderer.render(path.sample(3));
`eye` and `target` accept a three-component vector or a keyframe channel.
`fov` and `roll` accept a number or a keyframe channel.
Channels support `LINEAR`, `STEP`, `SMOOTH` and `CUBICSPLINE`, using the existing animation sampler.
+A keyframe on a `LINEAR` or `SMOOTH` channel can add `easing`, such as `easeInOutCubic` or `cubic-bezier(0.2, 0, 0, 1)`; see [animation curves](animation-curves.md#easing).
Cubic tangents use units per second. `fov` uses degrees, and `roll` uses radians around the viewing direction.
`up` is a constant vector. `near` and `far` are constant positive clipping distances.
diff --git a/docs/export-glb.md b/docs/export-glb.md
index 4b6464f9..40534791 100644
--- a/docs/export-glb.md
+++ b/docs/export-glb.md
@@ -108,6 +108,7 @@ Weights are normalised to sum to one, the skin's `bindMatrix` is folded into the
`options.clips` takes clips in `createAnimationClip` form (`clipFromGltfAnimation` converts an imported one) whose track targets are node names.
Translation, rotation and scale tracks are written as LINEAR, STEP or CUBICSPLINE.
SMOOTH becomes CUBICSPLINE with zero tangents, which equals its scalar easing and approximates rotation slerp.
+A track with eased keyframes (`easing`) is written as LINEAR with 32 samples per segment, because glTF has no easing.
A track on another property, or on a node that is not exported, fails with the fix.
```js
diff --git a/docs/guide.md b/docs/guide.md
index 69cf5bf4..3a774589 100644
--- a/docs/guide.md
+++ b/docs/guide.md
@@ -414,7 +414,7 @@ renderer.updateParts(parts);
renderer.render({ eye: [3,2,4], target: [0,0,0], time: 1 });
```
-Tracks target unique part names. Supported transform tracks are translation, rotation (quaternion XYZW) and scale. Material tracks include metallic, roughness and emission. Interpolation supports `LINEAR`, `STEP`, `SMOOTH` and `CUBICSPLINE`.
+Tracks target unique part names. Supported transform tracks are translation, rotation (quaternion XYZW) and scale. Material tracks include metallic, roughness and emission. Interpolation supports `LINEAR`, `STEP`, `SMOOTH` and `CUBICSPLINE`. A keyframe can add `easing` (`easeOutBack`, `easeInOutCubic`, `cubic-bezier(...)`) to shape its segment.
`sampleAnimationClip(clip, time)` returns samples without binding parts. Preserve the original graph and apply absolute time so seeking backwards reproduces the scene. Use `requestAnimationFrame` for playback, pause when hidden, and use a fixed sample time for export.
diff --git a/docs/parity.md b/docs/parity.md
index 61024b5f..3607e8eb 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -132,7 +132,7 @@ To move to a new Blender release, run `node scripts/parity-manual-snapshot.mjs`.
| Sculpting & Painting > Curves Sculpting | missing | No hair curves. | | #63 |
| Grease Pencil | out of scope | Decided in issue #23. | | |
| Animation & Rigging > Animation Editors | out of scope | Interface for a mouse. | | |
-| Animation & Rigging > Keyframes | partial | Linear, step, smooth and Hermite curves with deterministic seeks. There are no other easing types or keying sets. | [animation](../tests/animation.test.js) | |
+| Animation & Rigging > Keyframes | partial | Linear, step, smooth and Hermite curves with deterministic seeks, plus per-keyframe named easings (Sine, Quad, Cubic, Quart, Quint, Expo, Circ, Back, Bounce and Elastic, each in, out or in-out) and `cubic-bezier` (#286). Each easing matches Blender 5.2 within 1e-4 at 20 sample times. Back and Elastic take overshoot, amplitude and period. There are no Bezier handles or keying sets. | [animation](../tests/animation.test.js), [easing](../tests/easing.test.js) | #286 |
| Animation & Rigging > Armatures > Bones | partial | Recipe `armatures` list bones with a name, parent, head and tail, and each bone is a recipe node that tracks, `motion.ik` and a physics ragdoll (#96, `tests/ragdoll.test.js`: a capsule body per bone, spherical joints without swing limits, a seekable baked fall, at most 48 bones) address. No roll, bone shapes or custom properties. | [rigging](../tests/rigging.test.js) | #46 |
| Animation & Rigging > Armatures > Properties | partial | An armature has an id, a parent node, a transform, an optional bone-ID prefix and a `humanoid` or `quadruped` preset fitted to a mesh node or to bounds. No display settings or bone collections. | [rigging](../tests/rigging.test.js) | #46 |
| Animation & Rigging > Armatures > Structure | partial | Imported rigs keep their hierarchy, and recipes author one. A rig exports to GLB with its bones and a baked walk clip; Blender 5.2 opens it as 1 armature, 21 bones, 14 vertex-grouped meshes and 1 action. | [gltf](../tests/gltf.test.js), [rigging](../tests/rigging.test.js) | #46 |
diff --git a/scripts/blender-easing-golden.py b/scripts/blender-easing-golden.py
new file mode 100644
index 00000000..b0e2bfc3
--- /dev/null
+++ b/scripts/blender-easing-golden.py
@@ -0,0 +1,74 @@
+# Writes tests/fixtures/blender/easing-golden.json: every Blender keyframe easing evaluated on one channel that goes
+# from 0 to 1 over one frame, at 20 sample times. Run it when an easing case changes or Blender moves to a new release:
+# blender -b --factory-startup --python scripts/blender-easing-golden.py
+import json
+from pathlib import Path
+
+import bpy
+
+OUTPUT_PATH = Path(__file__).resolve().parent.parent / "tests" / "fixtures" / "blender" / "easing-golden.json"
+SAMPLE_COUNT = 20
+FAMILIES = {
+ "Sine": "SINE",
+ "Quad": "QUAD",
+ "Cubic": "CUBIC",
+ "Quart": "QUART",
+ "Quint": "QUINT",
+ "Expo": "EXPO",
+ "Circ": "CIRC",
+ "Back": "BACK",
+ "Bounce": "BOUNCE",
+ "Elastic": "ELASTIC",
+}
+# The 67js defaults for Elastic, given to Blender explicitly: Blender stores a period in frames (4.1 by default), which
+# has no meaning for a segment of unknown length, and treats 0 as a tiny period.
+DEFAULT_ELASTIC_SETTINGS = {"EASE_IN": {"amplitude": 1.0, "period": 0.3}, "EASE_OUT": {"amplitude": 1.0, "period": 0.3}, "EASE_IN_OUT": {"amplitude": 1.0, "period": 0.45}}
+DIRECTIONS = {"In": "EASE_IN", "Out": "EASE_OUT", "InOut": "EASE_IN_OUT"}
+# Non-default Back and Elastic settings. Blender's amplitude and period are absolute values; over a one-unit change in
+# one frame they equal the multiple of the change and the fraction of the segment that 67js takes.
+PARAMETER_CASES = [ # (easing as written in a keyframe, family, Blender easing, Blender settings)
+ ("easeOutBack(3)", "Back", "EASE_OUT", {"back": 3.0}),
+ ("easeInBack(0.5)", "Back", "EASE_IN", {"back": 0.5}),
+ ("easeInOutBack(2.5)", "Back", "EASE_IN_OUT", {"back": 2.5}),
+ ("easeOutElastic(1.5, 0.4)", "Elastic", "EASE_OUT", {"amplitude": 1.5, "period": 0.4}),
+ ("easeInElastic(2, 0.2)", "Elastic", "EASE_IN", {"amplitude": 2.0, "period": 0.2}),
+ ("easeInOutElastic(1.2, 0.3)", "Elastic", "EASE_IN_OUT", {"amplitude": 1.2, "period": 0.3}),
+]
+
+
+def evaluate_easing(interpolation, easing, settings):
+ bpy.ops.wm.read_factory_settings(use_empty=True)
+ cube = bpy.data.objects.new("cube", None)
+ bpy.context.scene.collection.objects.link(cube)
+ cube.location = (0.0, 0.0, 0.0)
+ cube.keyframe_insert("location", index=0, frame=0)
+ cube.location = (1.0, 0.0, 0.0)
+ cube.keyframe_insert("location", index=0, frame=1)
+ action = cube.animation_data.action
+ fcurve = action.layers[0].strips[0].channelbags[0].fcurves[0]
+ first_point = fcurve.keyframe_points[0]
+ first_point.interpolation = interpolation
+ first_point.easing = easing
+ for name, value in settings.items():
+ setattr(first_point, name, value)
+ return [fcurve.evaluate(index / (SAMPLE_COUNT - 1)) for index in range(SAMPLE_COUNT)]
+
+
+def main():
+ cases = []
+ for family, interpolation in FAMILIES.items():
+ for direction, easing in DIRECTIONS.items():
+ cases.append({
+ "easing": f"ease{direction}{family}",
+ "values": evaluate_easing(interpolation, easing, DEFAULT_ELASTIC_SETTINGS[easing] if family == "Elastic" else {}),
+ })
+ for name, family, easing, blender_settings in PARAMETER_CASES:
+ cases.append({
+ "easing": name,
+ "values": evaluate_easing(FAMILIES[family], easing, blender_settings),
+ })
+ output = {"blender": bpy.app.version_string, "sampleCount": SAMPLE_COUNT, "cases": cases}
+ OUTPUT_PATH.write_text(json.dumps(output, indent=1) + "\n", encoding="utf-8")
+
+
+main()
diff --git a/scripts/mcp-server.mjs b/scripts/mcp-server.mjs
index 5b73bbc8..6547b0ec 100644
--- a/scripts/mcp-server.mjs
+++ b/scripts/mcp-server.mjs
@@ -362,6 +362,8 @@ const geometry = z.discriminatedUnion('type', [
z.strictObject({ id: identifier, type: z.literal('grid'), segments: detail(1, 64) }),
z.strictObject({ id: identifier, type: z.literal('mesh'), base: z.discriminatedUnion('type', primitiveGeometries(false)).describe('Starting shape, converted to welded quads with axis face tags.'), edits: recipeMeshEdits.optional().describe('Replayable edit log, applied in order. Each item has the shape of one mesh_edit edit; read that tool for every op and field.'), stack: recipeMeshStack.optional().describe('Non-destructive modifier stack evaluated after the edits. Each item has the shape of one mesh_stack node; read that tool for the ops.'), smoothAngle: bounded(0, 180).optional().describe('Edges bending more than this many degrees render hard. Defaults to 30.') }),
]);
+// No description: this field repeats in every motion track schema. A wrong name fails with every valid form, and docs/agent-motion.md lists them.
+const easingField = z.string().max(80).optional();
function motionTrack(kind, property, value, tangent) {
return z.strictObject({
kind: z.literal(kind),
@@ -371,6 +373,7 @@ function motionTrack(kind, property, value, tangent) {
keyframes: z.array(z.strictObject({
time: z.number().min(0).max(30), value,
inTangent: tangent.optional(), outTangent: tangent.optional(),
+ easing: easingField,
})).min(1).max(64),
});
}
diff --git a/src/agent-motion.js b/src/agent-motion.js
index 73798775..7367d251 100644
--- a/src/agent-motion.js
+++ b/src/agent-motion.js
@@ -3,6 +3,7 @@ import { createCameraPath } from './camera-path.js';
import { createSkeletonPose } from './skeleton-pose.js';
import { createNodeConstraintEvaluator, normalizeConstraints, normalizeDrivers } from './node-constraints.js';
import { normalizeClipLayers } from './agent-clip-layers.js';
+import { normalizeKeyframeEasing } from './easing.js';
import { bounded, denseArray, finite, knownKeys, valueFrom } from './motion-validation.js';
const PROPERTIES = {
@@ -48,6 +49,7 @@ function copiedKeyframe(keyframe, interpolation) {
time: keyframe.time,
value: Array.isArray(keyframe.value) ? [...keyframe.value] : keyframe.value,
};
+ if (keyframe.easing !== undefined) result.easing = keyframe.easing;
if (interpolation === 'CUBICSPLINE') {
result.inTangent = Array.isArray(keyframe.inTangent) ? [...keyframe.inTangent] : keyframe.inTangent;
result.outTangent = Array.isArray(keyframe.outTangent) ? [...keyframe.outTangent] : keyframe.outTangent;
@@ -56,13 +58,18 @@ function copiedKeyframe(keyframe, interpolation) {
}
function normalizedKeyframe(keyframe, track, duration, interpolation) {
- knownKeys(keyframe, ['time', 'value', 'inTangent', 'outTangent'], 'motion keyframe');
+ knownKeys(keyframe, ['time', 'value', 'inTangent', 'outTangent', 'easing'], 'motion keyframe');
const size = PROPERTIES[track.kind][track.property];
const result = {
time: bounded(keyframe.time, 0, duration, 'Keyframe time'),
value: valueFrom(keyframe.value, size, 'Keyframe value'),
};
validateValue(track.kind, track.property, result.value);
+ const easing = normalizeKeyframeEasing(keyframe);
+ if (easing && interpolation !== 'LINEAR' && interpolation !== 'SMOOTH') {
+ throw new RangeError(`Keyframe easing needs LINEAR or SMOOTH interpolation, not ${interpolation}.`);
+ }
+ Object.assign(result, easing);
if (interpolation === 'CUBICSPLINE') {
result.inTangent = valueFrom(keyframe.inTangent, size, 'Incoming tangent');
result.outTangent = valueFrom(keyframe.outTangent, size, 'Outgoing tangent');
diff --git a/src/animation.js b/src/animation.js
index 22d4acd1..69d97c3f 100644
--- a/src/animation.js
+++ b/src/animation.js
@@ -1,4 +1,5 @@
import { mat4, quat } from 'gl-matrix';
+import { easedProgress, normalizeKeyframeEasing } from './easing.js';
const PROPERTY_SIZES = { translation: 3, rotation: 4, scale: 3, value: 1, emission: 1, metallic: 1, roughness: 1 };
const INTERPOLATIONS = new Set(['LINEAR', 'STEP', 'SMOOTH', 'CUBICSPLINE']);
@@ -70,6 +71,11 @@ export function createAnimationClip({ duration, loop = false, tracks = [] } = {}
throw new RangeError('Keyframe times must be within the clip duration.');
}
const compiledKeyframe = { time: keyframe.time, value: normalizedValue(track.property, keyframe.value) };
+ const easing = normalizeKeyframeEasing(keyframe);
+ if (easing && interpolation !== 'LINEAR' && interpolation !== 'SMOOTH') {
+ throw new RangeError(`Keyframe easing needs LINEAR or SMOOTH interpolation, not ${interpolation}.`);
+ }
+ Object.assign(compiledKeyframe, easing);
if (interpolation === 'CUBICSPLINE') {
compiledKeyframe.inTangent = normalizedTangent(track.property, keyframe.inTangent);
compiledKeyframe.outTangent = normalizedTangent(track.property, keyframe.outTangent);
@@ -140,7 +146,8 @@ function sampleTrackInto(track, time, output) {
}
return output;
}
- if (track.interpolation === 'SMOOTH') progress = progress * progress * (3 - 2 * progress);
+ if (start.easing !== undefined) progress = easedProgress(start, progress);
+ else if (track.interpolation === 'SMOOTH') progress = progress * progress * (3 - 2 * progress);
if (track.property === 'rotation') return quat.slerp(output, start.value, end.value, progress);
for (let axis = 0; axis < output.length; axis++) {
const startValue = output.length === 1 ? start.value : start.value[axis];
@@ -150,6 +157,28 @@ function sampleTrackInto(track, time, output) {
return output;
}
+/**
+ * Linear keyframes that trace a track with eased segments, for formats with no easing (glTF). Each segment gets
+ * `stepsPerSegment` linear pieces; a track without easing comes back unchanged.
+ */
+export function bakeEasedKeyframes(track, stepsPerSegment) {
+ if (!track.keyframes.some(keyframe => keyframe.easing !== undefined)) return track.keyframes;
+ const size = PROPERTY_SIZES[track.property];
+ const baked = [];
+ for (let index = 0; index < track.keyframes.length; index++) {
+ const start = track.keyframes[index];
+ baked.push({ time: start.time, value: start.value });
+ const end = track.keyframes[index + 1];
+ if (!end) break;
+ for (let step = 1; step < stepsPerSegment; step++) {
+ const time = start.time + (end.time - start.time) * step / stepsPerSegment;
+ const output = sampleTrackInto(track, time, new Float64Array(size));
+ baked.push({ time, value: size === 1 ? output[0] : Array.from(output) });
+ }
+ }
+ return baked;
+}
+
function normalizedTime(clip, time) {
if (!Number.isFinite(time)) throw new TypeError('Animation time must be finite.');
if (!clip.loop) return Math.max(0, Math.min(clip.duration, time));
diff --git a/src/easing.js b/src/easing.js
new file mode 100644
index 00000000..dd9c83a6
--- /dev/null
+++ b/src/easing.js
@@ -0,0 +1,262 @@
+// Named easing curves for keyframe segments. The formulas are Blender's (Graph Editor, F-Curve easing), written for a
+// segment that runs from progress 0 to 1, so a name gives the same value as the same Blender easing on a one-unit change.
+// `cubic-bezier(x1, y1, x2, y2)` follows the CSS definition.
+
+const FAMILIES = ['Sine', 'Quad', 'Cubic', 'Quart', 'Quint', 'Expo', 'Circ', 'Back', 'Bounce', 'Elastic'];
+const DIRECTIONS = ['In', 'Out', 'InOut'];
+
+const BACK_IN_OUT_FACTOR = 1.525;
+const FULL_TURN = 2 * Math.PI;
+const BEZIER_NEWTON_STEPS = 8;
+const BEZIER_BISECTION_STEPS = 48;
+const BEZIER_PRECISION = 1e-7;
+
+export const EASING_NAMES = Object.freeze(['linear', ...FAMILIES.flatMap(family => DIRECTIONS.map(direction => `ease${direction}${family}`))]);
+const NAME_SET = new Set(EASING_NAMES);
+const NAME_BY_LOWERCASE = new Map(EASING_NAMES.map(name => [name.toLowerCase(), name]));
+// A name, optionally followed by comma separated numbers in parentheses.
+const EASING_PATTERN = /^([A-Za-z][A-Za-z-]*)\s*(?:\(([^()]*)\))?$/;
+const BEZIER_X_BOUNDS = [0, 1];
+const BEZIER_Y_BOUNDS = [-4, 5];
+
+// Back takes an overshoot, as easeOutBack(3). Elastic takes an amplitude (a multiple of the change) and a period (a
+// fraction of the segment), as easeOutElastic(1.5, 0.4). Blender stores both in absolute units; over a one-unit change in
+// one frame they are the same numbers.
+const PARAMETERS_BY_FAMILY = {
+ Back: [{ name: 'overshoot', bounds: [0, 10], fallback: () => 1.70158 }],
+ Elastic: [
+ { name: 'amplitude', bounds: [1, 10], fallback: () => 1 },
+ { name: 'period', bounds: [0.05, 2], fallback: direction => (direction === 'InOut' ? 0.45 : 0.3) },
+ ],
+};
+
+export const EASING_HELP = 'linear, cubic-bezier(x1, y1, x2, y2), or ease<In|Out|InOut><Sine|Quad|Cubic|Quart|Quint|Expo|Circ|Back|Bounce|Elastic>, such as easeOutBack; Back takes (overshoot) and Elastic (amplitude, period)';
+
+function powerIn(exponent) {
+ return progress => progress ** exponent;
+}
+
+function powerOut(exponent) {
+ return progress => 1 - (1 - progress) ** exponent;
+}
+
+function powerInOut(exponent) {
+ return progress => {
+ if (progress < 0.5) return 2 ** (exponent - 1) * progress ** exponent;
+ return 1 - (-2 * progress + 2) ** exponent / 2;
+ };
+}
+
+// Blender 5.2 rescales 2^(10x) so the curve runs exactly from 0 to 1.
+const EXPONENTIAL_FLOOR = 2 ** -10;
+const EXPONENTIAL_SCALE = 1 - EXPONENTIAL_FLOOR;
+
+function exponentialIn(progress) {
+ return (2 ** (10 * (progress - 1)) - EXPONENTIAL_FLOOR) / EXPONENTIAL_SCALE;
+}
+
+function exponentialOut(progress) {
+ return (1 - 2 ** (-10 * progress)) / EXPONENTIAL_SCALE;
+}
+
+function bounceOut(progress) {
+ if (progress < 1 / 2.75) return 7.5625 * progress * progress;
+ if (progress < 2 / 2.75) {
+ const shifted = progress - 1.5 / 2.75;
+ return 7.5625 * shifted * shifted + 0.75;
+ }
+ if (progress < 2.5 / 2.75) {
+ const shifted = progress - 2.25 / 2.75;
+ return 7.5625 * shifted * shifted + 0.9375;
+ }
+ const shifted = progress - 2.625 / 2.75;
+ return 7.5625 * shifted * shifted + 0.984375;
+}
+
+function elasticDecay(shifted, amplitude, period, phase) {
+ return amplitude * 2 ** (10 * shifted) * Math.sin((shifted - phase) * FULL_TURN / period);
+}
+
+function elasticPhase(amplitude, period) {
+ return period / FULL_TURN * Math.asin(1 / amplitude);
+}
+
+const FAMILY_CURVES = {
+ Sine: {
+ In: progress => 1 - Math.cos(progress * Math.PI / 2),
+ Out: progress => Math.sin(progress * Math.PI / 2),
+ InOut: progress => -(Math.cos(Math.PI * progress) - 1) / 2,
+ },
+ Quad: { In: powerIn(2), Out: powerOut(2), InOut: powerInOut(2) },
+ Cubic: { In: powerIn(3), Out: powerOut(3), InOut: powerInOut(3) },
+ Quart: { In: powerIn(4), Out: powerOut(4), InOut: powerInOut(4) },
+ Quint: { In: powerIn(5), Out: powerOut(5), InOut: powerInOut(5) },
+ Expo: {
+ In: exponentialIn,
+ Out: exponentialOut,
+ InOut: progress => (progress < 0.5 ? exponentialIn(2 * progress) / 2 : 0.5 + exponentialOut(2 * progress - 1) / 2),
+ },
+ Circ: {
+ In: progress => 1 - Math.sqrt(1 - progress * progress),
+ Out: progress => Math.sqrt(1 - (progress - 1) ** 2),
+ InOut: progress => {
+ if (progress < 0.5) return -0.5 * (Math.sqrt(1 - (2 * progress) ** 2) - 1);
+ return 0.5 * (Math.sqrt(1 - (2 * progress - 2) ** 2) + 1);
+ },
+ },
+ Bounce: {
+ In: progress => 1 - bounceOut(1 - progress),
+ Out: bounceOut,
+ InOut: progress => (progress < 0.5 ? (1 - bounceOut(1 - 2 * progress)) / 2 : bounceOut(2 * progress - 1) / 2 + 0.5),
+ },
+};
+
+function backCurve(direction, overshoot) {
+ if (direction === 'In') return progress => progress * progress * ((overshoot + 1) * progress - overshoot);
+ if (direction === 'Out') {
+ return progress => {
+ const shifted = progress - 1;
+ return shifted * shifted * ((overshoot + 1) * shifted + overshoot) + 1;
+ };
+ }
+ const scaled = overshoot * BACK_IN_OUT_FACTOR;
+ return progress => {
+ const doubled = progress * 2;
+ if (doubled < 1) return 0.5 * doubled * doubled * ((scaled + 1) * doubled - scaled);
+ const shifted = doubled - 2;
+ return 0.5 * (shifted * shifted * ((scaled + 1) * shifted + scaled) + 2);
+ };
+}
+
+function elasticCurve(direction, amplitude, period) {
+ const phase = elasticPhase(amplitude, period);
+ const easeIn = progress => {
+ if (progress === 0) return 0;
+ if (progress === 1) return 1;
+ return -elasticDecay(progress - 1, amplitude, period, phase);
+ };
+ // Blender 5.2 builds out and in-out by mirroring the in curve.
+ if (direction === 'In') return easeIn;
+ if (direction === 'Out') return progress => 1 - easeIn(1 - progress);
+ return progress => (progress < 0.5 ? easeIn(2 * progress) / 2 : 1 - easeIn(2 * (1 - progress)) / 2);
+}
+
+function bezierCurve(x1, y1, x2, y2) {
+ const coordinate = (first, second, parameter) => {
+ const inverse = 1 - parameter;
+ return 3 * inverse * inverse * parameter * first + 3 * inverse * parameter * parameter * second + parameter ** 3;
+ };
+ const slope = parameter => {
+ const inverse = 1 - parameter;
+ return 3 * inverse * inverse * x1 + 6 * inverse * parameter * (x2 - x1) + 3 * parameter * parameter * (1 - x2);
+ };
+ return progress => {
+ if (progress <= 0) return 0;
+ if (progress >= 1) return 1;
+ let parameter = progress;
+ for (let step = 0; step < BEZIER_NEWTON_STEPS; step++) {
+ const error = coordinate(x1, x2, parameter) - progress;
+ if (Math.abs(error) < BEZIER_PRECISION) return coordinate(y1, y2, parameter);
+ const derivative = slope(parameter);
+ if (Math.abs(derivative) < 1e-6) break;
+ parameter -= error / derivative;
+ }
+ let low = 0;
+ let high = 1;
+ parameter = progress;
+ for (let step = 0; step < BEZIER_BISECTION_STEPS; step++) {
+ if (coordinate(x1, x2, parameter) < progress) low = parameter;
+ else high = parameter;
+ parameter = (low + high) / 2;
+ }
+ return coordinate(y1, y2, parameter);
+ };
+}
+
+function finiteWithin(value, bounds, label) {
+ if (!Number.isFinite(value) || value < bounds[0] || value > bounds[1]) {
+ throw new RangeError(`${label} must be a number from ${bounds[0]} to ${bounds[1]}.`);
+ }
+ return value;
+}
+
+function unknownEasing(name) {
+ const base = typeof name === 'string' ? name.replace(/\(.*$/s, '').trim() : undefined;
+ const suggestion = base === undefined ? undefined : NAME_BY_LOWERCASE.get(base.toLowerCase());
+ const hint = suggestion ? ` Did you mean ${suggestion}?` : '';
+ return new RangeError(`Unknown easing ${JSON.stringify(name)}.${hint} Use ${EASING_HELP}.`);
+}
+
+function splitName(name) {
+ const direction = DIRECTIONS.find(candidate => name.startsWith(`ease${candidate}`) && FAMILIES.includes(name.slice(4 + candidate.length)));
+ return { direction, family: name.slice(4 + direction.length) };
+}
+
+function numbersFrom(argumentText, name) {
+ if (argumentText.trim() === '') return [];
+ return argumentText.split(',').map(part => {
+ const value = Number(part);
+ if (part.trim() === '' || !Number.isFinite(value)) throw new RangeError(`${name} arguments must be finite numbers; got ${JSON.stringify(part.trim())}.`);
+ return value;
+ });
+}
+
+function bezierFrom(name, numbers) {
+ if (numbers.length !== 4) throw new RangeError(`${name} needs four numbers: cubic-bezier(x1, y1, x2, y2).`);
+ const [x1, y1, x2, y2] = numbers;
+ finiteWithin(x1, BEZIER_X_BOUNDS, 'cubic-bezier x1');
+ finiteWithin(x2, BEZIER_X_BOUNDS, 'cubic-bezier x2');
+ finiteWithin(y1, BEZIER_Y_BOUNDS, 'cubic-bezier y1');
+ finiteWithin(y2, BEZIER_Y_BOUNDS, 'cubic-bezier y2');
+ return bezierCurve(x1, y1, x2, y2);
+}
+
+function namedCurveFrom(name, numbers) {
+ const { direction, family } = splitName(name);
+ const allowed = PARAMETERS_BY_FAMILY[family] ?? [];
+ if (numbers.length > allowed.length) {
+ const usage = allowed.length ? `${name}(${allowed.map(parameter => parameter.name).join(', ')})` : name;
+ throw new RangeError(`${name} takes ${allowed.length ? `at most ${allowed.length} argument${allowed.length > 1 ? 's' : ''}` : 'no arguments'}: ${usage}.`);
+ }
+ const [first, second] = allowed.map((parameter, index) => (numbers[index] === undefined ? parameter.fallback(direction) : finiteWithin(numbers[index], parameter.bounds, `${name} ${parameter.name}`)));
+ if (family === 'Back') return backCurve(direction, first);
+ if (family === 'Elastic') return elasticCurve(direction, first, second);
+ return FAMILY_CURVES[family][direction];
+}
+
+/** Compiles an easing string to a function from segment progress to eased progress, or throws a RangeError that says what is valid. */
+export function parseEasing(text) {
+ const match = typeof text === 'string' ? EASING_PATTERN.exec(text.trim()) : null;
+ if (!match) throw unknownEasing(text);
+ const name = match[1];
+ const hasArguments = match[2] !== undefined;
+ if (name === 'cubic-bezier') {
+ if (!hasArguments) throw unknownEasing(text);
+ return bezierFrom(name, numbersFrom(match[2], name));
+ }
+ if (!NAME_SET.has(name)) throw unknownEasing(text);
+ if (name === 'linear') {
+ if (hasArguments) throw new RangeError('linear takes no arguments.');
+ return progress => progress;
+ }
+ return namedCurveFrom(name, hasArguments ? numbersFrom(match[2], name) : []);
+}
+
+/** Validates a keyframe's easing and returns the field to store ({ easing }), or undefined for a keyframe without one. */
+export function normalizeKeyframeEasing(keyframe) {
+ if (keyframe.easing === undefined) return undefined;
+ parseEasing(keyframe.easing);
+ return { easing: keyframe.easing.trim() };
+}
+
+const compiledByKeyframe = new WeakMap();
+
+/** Maps linear segment progress (0 to 1) through the easing stored on a normalized keyframe. */
+export function easedProgress(keyframe, progress) {
+ let curve = compiledByKeyframe.get(keyframe);
+ if (!curve) {
+ curve = parseEasing(keyframe.easing);
+ compiledByKeyframe.set(keyframe, curve);
+ }
+ return curve(progress);
+}
diff --git a/src/export-skeleton.js b/src/export-skeleton.js
index 77f226a2..68e5023a 100644
--- a/src/export-skeleton.js
+++ b/src/export-skeleton.js
@@ -1,4 +1,8 @@
import { mat4, quat, vec3 } from 'gl-matrix';
+import { bakeEasedKeyframes } from './animation.js';
+
+// glTF has no easing, so an eased segment is written as this many linear pieces.
+const EASING_BAKE_STEPS_PER_SEGMENT = 32;
const GLTF_PATHS = { translation: 'translation', rotation: 'rotation', scale: 'scale', weights: 'weights' };
const COMPONENTS_BY_PATH = { translation: 3, rotation: 4, scale: 3 };
@@ -168,7 +172,9 @@ function trackOutput(track) {
const GLTF_INTERPOLATION = { LINEAR: 'LINEAR', STEP: 'STEP', SMOOTH: 'CUBICSPLINE', CUBICSPLINE: 'CUBICSPLINE' };
-function writeTrack(writer, animation, track, nodeIndex) {
+function writeTrack(writer, animation, sourceTrack, nodeIndex) {
+ const bakedKeyframes = bakeEasedKeyframes(sourceTrack, EASING_BAKE_STEPS_PER_SEGMENT);
+ const track = bakedKeyframes === sourceTrack.keyframes ? sourceTrack : { ...sourceTrack, keyframes: bakedKeyframes, interpolation: 'LINEAR' };
const path = GLTF_PATHS[track.property];
if (!path) {
throw new RangeError(`GLB export cannot write ${track.property} tracks (target ${track.target}). Only translation, rotation, scale and weights tracks are exported; remove the others from the clip.`);
diff --git a/tests/agent-modeling-suite.test.js b/tests/agent-modeling-suite.test.js
index c7e333e2..b86db0a1 100644
--- a/tests/agent-modeling-suite.test.js
+++ b/tests/agent-modeling-suite.test.js
@@ -6,6 +6,7 @@ import { REFERENCES } from '../bench/agent-modeling/references.mjs';
import { GALLERY_LIGHT_POSITIONS } from '../bench/agent-modeling/gallery.mjs';
import { COLONNADE_BEST_PLACE, COLONNADE_LIGHT_POSITIONS } from '../bench/agent-modeling/colonnade.mjs';
import { DUSK_GRADES } from '../bench/agent-modeling/dusk.mjs';
+import { EASING_PLAIN_SOLUTION } from '../bench/agent-modeling/easing.mjs';
test('the look pick passes the golden grade and fails the dim, the pale and a moved scene', async () => {
const task = taskById('look-pick');
@@ -277,3 +278,15 @@ test('the hard light pick passes the least shadowed place and fails every other
movedPost.nodes.find(node => node.id === 'post-3').translation[0] = 3;
assert.ok(failedKinds(await gradeRecipe(task, movedPost)).includes('centreAt'));
});
+
+test('the overshoot lift passes with one named easing or with hand-placed keyframes, and fails without an overshoot', async () => {
+ const task = taskById('overshoot-lift');
+ assert.deepEqual(failedKinds(await gradeRecipe(task, structuredClone(REFERENCES['overshoot-lift']))), []);
+ assert.deepEqual(failedKinds(await gradeRecipe(task, structuredClone(EASING_PLAIN_SOLUTION))), []);
+ const keyframeCount = recipe => recipe.motion.tracks[0].keyframes.length;
+ assert.ok(keyframeCount(REFERENCES['overshoot-lift']) < keyframeCount(EASING_PLAIN_SOLUTION));
+
+ const noOvershoot = structuredClone(REFERENCES['overshoot-lift']);
+ delete noOvershoot.motion.tracks[0].keyframes[0].easing;
+ assert.deepEqual(failedKinds(await gradeRecipe(task, noOvershoot)), ['overshoot']);
+});
diff --git a/tests/easing.test.js b/tests/easing.test.js
new file mode 100644
index 00000000..044aefb0
--- /dev/null
+++ b/tests/easing.test.js
@@ -0,0 +1,175 @@
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import test from 'node:test';
+import { mat4 } from 'gl-matrix';
+import { createAnimationClip, sampleAnimationClip } from '../src/animation.js';
+import { compileAgentMotion, normalizeAgentMotion } from '../src/agent-motion.js';
+import { createCameraPath } from '../src/camera-path.js';
+import { EASING_NAMES } from '../src/easing.js';
+import { exportGlb } from '../src/export.js';
+import { box } from '../src/geometry.js';
+import { parseGltf } from '../src/gltf.js';
+
+const golden = JSON.parse(readFileSync(new URL('./fixtures/blender/easing-golden.json', import.meta.url), 'utf8'));
+const BLENDER_TOLERANCE = 1e-4;
+
+function scalarClip(easing, duration = 1) {
+ return createAnimationClip({
+ duration,
+ tracks: [{
+ target: 'part', property: 'value',
+ keyframes: [{ time: 0, value: 0, easing }, { time: duration, value: 1 }],
+ }],
+ });
+}
+
+test('every easing matches Blender 5.2 at 20 sample times within 1e-4', () => {
+ assert.equal(golden.sampleCount, 20);
+ for (const blenderCase of golden.cases) {
+ const clip = scalarClip(blenderCase.easing);
+ blenderCase.values.forEach((expected, index) => {
+ const time = index / (golden.sampleCount - 1);
+ const actual = sampleAnimationClip(clip, time)[0].value;
+ assert.ok(Math.abs(actual - expected) < BLENDER_TOLERANCE, `${blenderCase.easing} at ${time}: ${actual} differs from Blender ${expected}`);
+ });
+ }
+});
+
+test('the golden covers every named easing except linear', () => {
+ const covered = new Set(golden.cases.map(blenderCase => blenderCase.easing.replace(/\(.*/, '')));
+ for (const name of EASING_NAMES.filter(name => name !== 'linear')) assert.ok(covered.has(name), `${name} has no Blender case`);
+});
+
+test('seeks are deterministic: the same time gives the same value in any order', () => {
+ for (const name of EASING_NAMES) {
+ const clip = scalarClip(name);
+ const forward = [0.1, 0.37, 0.8].map(time => sampleAnimationClip(clip, time)[0].value);
+ const backward = [0.8, 0.37, 0.1].map(time => sampleAnimationClip(clip, time)[0].value).reverse();
+ assert.deepEqual(backward, forward, name);
+ }
+ const bezier = scalarClip('cubic-bezier(0.34, 1.56, 0.64, 1)');
+ assert.equal(sampleAnimationClip(bezier, 0.42)[0].value, sampleAnimationClip(bezier, 0.42)[0].value);
+});
+
+test('segments start and end on their keyframe values', () => {
+ for (const name of EASING_NAMES) {
+ const clip = scalarClip(name);
+ assert.ok(Math.abs(sampleAnimationClip(clip, 0)[0].value) < 1e-12, name);
+ assert.ok(Math.abs(sampleAnimationClip(clip, 1)[0].value - 1) < 1e-12, name);
+ }
+});
+
+test('cubic-bezier follows the CSS curve and may overshoot with y outside 0..1', () => {
+ const ease = scalarClip('cubic-bezier(0.25, 0.1, 0.25, 1)');
+ // The CSS "ease" curve at 0.5 progress is about 0.8024.
+ assert.ok(Math.abs(sampleAnimationClip(ease, 0.5)[0].value - 0.80240) < 1e-3);
+ const diagonal = scalarClip('cubic-bezier(0.25, 0.25, 0.75, 0.75)');
+ assert.ok(Math.abs(sampleAnimationClip(diagonal, 0.3)[0].value - 0.3) < 1e-6);
+ const overshoot = scalarClip('cubic-bezier(0.34, 1.56, 0.64, 1)');
+ assert.ok(sampleAnimationClip(overshoot, 0.5)[0].value > 1);
+});
+
+test('easing applies to rotation, applies to the segment after its keyframe and replaces smoothstep', () => {
+ const quaternionEnd = [0, 0, Math.sin(Math.PI / 4), Math.cos(Math.PI / 4)];
+ const rotation = createAnimationClip({
+ duration: 1,
+ tracks: [{ target: 'part', property: 'rotation', keyframes: [{ time: 0, value: [0, 0, 0, 1], easing: 'easeInQuad' }, { time: 1, value: quaternionEnd }] }],
+ });
+ const halfway = sampleAnimationClip(rotation, 0.5)[0].value;
+ const angle = 2 * Math.atan2(halfway[2], halfway[3]);
+ assert.ok(Math.abs(angle - 0.25 * Math.PI / 2) < 1e-9);
+ const smooth = createAnimationClip({
+ duration: 2,
+ tracks: [{
+ target: 'part', property: 'value', interpolation: 'SMOOTH',
+ keyframes: [{ time: 0, value: 0 }, { time: 1, value: 1, easing: 'linear' }, { time: 2, value: 2 }],
+ }],
+ });
+ assert.ok(Math.abs(sampleAnimationClip(smooth, 0.25)[0].value - 0.15625) < 1e-12);
+ assert.ok(Math.abs(sampleAnimationClip(smooth, 1.25)[0].value - 1.25) < 1e-12);
+});
+
+test('an unknown easing is an error that names the valid forms', () => {
+ assert.throws(() => scalarClip('bouncy'), /Unknown easing "bouncy".*easeOutBack/);
+ assert.throws(() => scalarClip('easeoutback'), /Did you mean easeOutBack/);
+ assert.throws(() => scalarClip('easeOutBounc'), /Unknown easing/);
+ assert.throws(() => scalarClip('cubic-bezier(0.5, 1)'), /needs four numbers/);
+ assert.throws(() => scalarClip('cubic-bezier(1.5, 0, 0.5, 1)'), /x1 must be a number from 0 to 1/);
+ assert.throws(() => scalarClip('cubic-bezier(0, 0, 1, 99)'), /y2 must be a number from -4 to 5/);
+ assert.throws(() => scalarClip(7), /Unknown easing 7/);
+});
+
+test('Back and Elastic take bounded arguments and other easings take none', () => {
+ const defaultOvershoot = scalarClip('easeOutBack');
+ const explicitOvershoot = scalarClip('easeOutBack(1.70158)');
+ assert.equal(sampleAnimationClip(defaultOvershoot, 0.4)[0].value, sampleAnimationClip(explicitOvershoot, 0.4)[0].value);
+ assert.ok(sampleAnimationClip(scalarClip('easeOutBack(4)'), 0.4)[0].value > sampleAnimationClip(defaultOvershoot, 0.4)[0].value);
+ assert.equal(sampleAnimationClip(scalarClip('easeOutElastic(1)'), 0.3)[0].value, sampleAnimationClip(scalarClip('easeOutElastic(1, 0.3)'), 0.3)[0].value);
+ assert.equal(sampleAnimationClip(scalarClip(' easeOutBack ( 2 ) '), 0.4)[0].value, sampleAnimationClip(scalarClip('easeOutBack(2)'), 0.4)[0].value);
+ assert.throws(() => scalarClip('easeOutSine(2)'), /easeOutSine takes no arguments/);
+ assert.throws(() => scalarClip('easeOutBack(1, 2)'), /easeOutBack takes at most 1 argument: easeOutBack\(overshoot\)/);
+ assert.throws(() => scalarClip('easeOutBack(11)'), /easeOutBack overshoot must be a number from 0 to 10/);
+ assert.throws(() => scalarClip('easeOutElastic(0.5)'), /easeOutElastic amplitude must be a number from 1 to 10/);
+ assert.throws(() => scalarClip('easeOutElastic(2, 0)'), /easeOutElastic period must be a number from 0.05 to 2/);
+ assert.throws(() => scalarClip('easeOutBack(fast)'), /arguments must be finite numbers/);
+ assert.throws(() => scalarClip('linear(1)'), /linear takes no arguments/);
+});
+
+test('easing is rejected on STEP and CUBICSPLINE tracks', () => {
+ const keyframes = [{ time: 0, value: 0, easing: 'easeOutBack', inTangent: 0, outTangent: 0 }, { time: 1, value: 1, inTangent: 0, outTangent: 0 }];
+ for (const interpolation of ['STEP', 'CUBICSPLINE']) {
+ assert.throws(() => createAnimationClip({ duration: 1, tracks: [{ target: 'part', property: 'value', interpolation, keyframes }] }), /needs LINEAR or SMOOTH/);
+ }
+});
+
+const recipe = {
+ nodes: [{ id: 'lid' }],
+ materials: [{ id: 'bulb', tag: 'surface', color: [0.2, 0.3, 0.4], roughness: 0.5, metallic: 0, emission: 0 }],
+ camera: { eye: [1, 0, 0], target: [0, 0, 0], up: [0, 1, 0], fov: 45, near: 0.1, far: 100 },
+};
+
+test('recipe motion keeps easing on node, material and camera tracks and rejects an unknown name', () => {
+ const input = {
+ duration: 1,
+ tracks: [
+ { kind: 'node', id: 'lid', property: 'translation', keyframes: [{ time: 0, value: [0, 0, 0], easing: 'easeOutBack(3)' }, { time: 1, value: [0, 1, 0] }] },
+ { kind: 'material', id: 'bulb', property: 'emission', keyframes: [{ time: 0, value: 0, easing: 'easeInOutCubic' }, { time: 1, value: 4 }] },
+ { kind: 'camera', property: 'fov', keyframes: [{ time: 0, value: 30, easing: 'cubic-bezier(0.2, 0, 0, 1)' }, { time: 1, value: 60 }] },
+ ],
+ };
+ const normalized = normalizeAgentMotion(input, recipe);
+ assert.equal(normalized.tracks[0].keyframes[0].easing, 'easeOutBack(3)');
+ assert.equal(normalized.tracks[1].keyframes[0].easing, 'easeInOutCubic');
+ assert.equal(normalized.tracks[2].keyframes[0].easing, 'cubic-bezier(0.2, 0, 0, 1)');
+ const sampler = compileAgentMotion(input, recipe);
+ const overshootOutput = sampler.sample(0.6);
+ assert.ok(overshootOutput.nodes.get('lid').translation[1] > 1, 'easeOutBack passes its end value');
+ assert.ok(sampler.sample(0.6).nodes.get('lid').translation[1] === overshootOutput.nodes.get('lid').translation[1]);
+ input.tracks[0].keyframes[0].easing = 'springy';
+ assert.throws(() => normalizeAgentMotion(input, recipe), /Unknown easing "springy"/);
+});
+
+test('camera path channels take easing', () => {
+ const path = createCameraPath({
+ duration: 1,
+ fov: { keyframes: [{ time: 0, value: 30, easing: 'easeInQuad' }, { time: 1, value: 50 }] },
+ eye: [0, 0, 4],
+ });
+ assert.ok(Math.abs(path.sample(0.5).fov - 35) < 1e-9);
+});
+
+test('GLB export bakes eased tracks to linear samples that follow the curve', async () => {
+ const part = { name: 'Lid', geometry: box(), matrix: mat4.create(), material: { color: [1, 1, 1], metallic: 0, roughness: 1 } };
+ const clip = createAnimationClip({
+ duration: 1,
+ tracks: [{ target: 'Lid', property: 'translation', keyframes: [{ time: 0, value: [0, 0, 0], easing: 'easeOutBounce' }, { time: 1, value: [0, 1, 0] }] }],
+ });
+ const copy = await parseGltf(exportGlb([part], { clips: [{ name: 'Drop', ...clip }] }));
+ const track = copy.animations[0].tracks[0];
+ assert.ok(track.times.length > 16, 'the eased segment is sampled, not written as two keys');
+ const tolerance = 1e-5;
+ track.times.forEach((time, index) => {
+ const expected = sampleAnimationClip(clip, time)[0].value[1];
+ assert.ok(Math.abs(track.values[index * 3 + 1] - expected) < tolerance, `sample at ${time}`);
+ });
+});
diff --git a/tests/fixtures/blender/easing-golden.json b/tests/fixtures/blender/easing-golden.json
new file mode 100644
index 00000000..9c9d4eb9
--- /dev/null
+++ b/tests/fixtures/blender/easing-golden.json
@@ -0,0 +1,906 @@
+{
+ "blender": "5.2.2 LTS",
+ "sampleCount": 20,
+ "cases": [
+ {
+ "easing": "easeInSine",
+ "values": [
+ 0.0,
+ 0.003415524959564209,
+ 0.013638675212860107,
+ 0.03059971332550049,
+ 0.05418276786804199,
+ 0.08422666788101196,
+ 0.1205262541770935,
+ 0.16283351182937622,
+ 0.2108595371246338,
+ 0.2642761468887329,
+ 0.32271844148635864,
+ 0.38578730821609497,
+ 0.4530518054962158,
+ 0.524052619934082,
+ 0.5983045697212219,
+ 0.6753005981445312,
+ 0.7545146346092224,
+ 0.8354054689407349,
+ 0.9174207448959351,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutSine",
+ "values": [
+ 0.0,
+ 0.0825793519616127,
+ 0.1645946055650711,
+ 0.24548548460006714,
+ 0.3246994912624359,
+ 0.40169546008110046,
+ 0.47594738006591797,
+ 0.5469481348991394,
+ 0.6142127513885498,
+ 0.6772816181182861,
+ 0.7357239723205566,
+ 0.789140522480011,
+ 0.8371664881706238,
+ 0.8794737458229065,
+ 0.915773332118988,
+ 0.945817232131958,
+ 0.9694002866744995,
+ 0.9863613247871399,
+ 0.9965844750404358,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutSine",
+ "values": [
+ 0.0,
+ 0.006819337606430054,
+ 0.027091383934020996,
+ 0.06026312708854675,
+ 0.1054297685623169,
+ 0.16135922074317932,
+ 0.2265259027481079,
+ 0.29915228486061096,
+ 0.3772573173046112,
+ 0.45871037244796753,
+ 0.541289746761322,
+ 0.6227427124977112,
+ 0.7008476853370667,
+ 0.7734740972518921,
+ 0.8386408090591431,
+ 0.8945702910423279,
+ 0.9397369623184204,
+ 0.972908616065979,
+ 0.9931806325912476,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInQuad",
+ "values": [
+ 0.0,
+ 0.0027700832579284906,
+ 0.011080333031713963,
+ 0.024930745363235474,
+ 0.04432133212685585,
+ 0.06925208121538162,
+ 0.0997229814529419,
+ 0.13573406636714935,
+ 0.1772853285074234,
+ 0.22437673807144165,
+ 0.2770083248615265,
+ 0.33518004417419434,
+ 0.3988919258117676,
+ 0.4681440591812134,
+ 0.5429362654685974,
+ 0.623268723487854,
+ 0.7091413140296936,
+ 0.8005539774894714,
+ 0.8975069522857666,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutQuad",
+ "values": [
+ 0.0,
+ 0.10249307006597519,
+ 0.19944599270820618,
+ 0.2908587157726288,
+ 0.3767313063144684,
+ 0.4570637345314026,
+ 0.5318559408187866,
+ 0.6011080145835876,
+ 0.6648198962211609,
+ 0.7229917049407959,
+ 0.7756232619285583,
+ 0.8227146863937378,
+ 0.8642659187316895,
+ 0.9002770185470581,
+ 0.9307478666305542,
+ 0.9556786417961121,
+ 0.9750692248344421,
+ 0.988919734954834,
+ 0.9972299933433533,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutQuad",
+ "values": [
+ 0.0,
+ 0.005540166515856981,
+ 0.022160666063427925,
+ 0.04986149072647095,
+ 0.0886426642537117,
+ 0.13850416243076324,
+ 0.1994459629058838,
+ 0.2714681327342987,
+ 0.3545706570148468,
+ 0.4487534761428833,
+ 0.5512465834617615,
+ 0.6454293727874756,
+ 0.7285318374633789,
+ 0.8005540370941162,
+ 0.861495852470398,
+ 0.9113574028015137,
+ 0.950138509273529,
+ 0.9778393507003784,
+ 0.994459867477417,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInCubic",
+ "values": [
+ 0.0,
+ 0.00014579386333934963,
+ 0.001166350906714797,
+ 0.003936433233320713,
+ 0.009330807253718376,
+ 0.018224231898784637,
+ 0.031491465866565704,
+ 0.05000728741288185,
+ 0.07464645802974701,
+ 0.10628371685743332,
+ 0.1457938551902771,
+ 0.1940516084432602,
+ 0.25193172693252563,
+ 0.3203091025352478,
+ 0.4000582993030548,
+ 0.492054283618927,
+ 0.5971716642379761,
+ 0.7162851095199585,
+ 0.8502697348594666,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutCubic",
+ "values": [
+ 0.0,
+ 0.14973026514053345,
+ 0.2837148904800415,
+ 0.4028283357620239,
+ 0.5079457759857178,
+ 0.5999417304992676,
+ 0.6796908974647522,
+ 0.7480682730674744,
+ 0.8059483766555786,
+ 0.8542061448097229,
+ 0.8937162756919861,
+ 0.9253535270690918,
+ 0.9499927163124084,
+ 0.9685085415840149,
+ 0.9817757606506348,
+ 0.9906691908836365,
+ 0.9960635900497437,
+ 0.9988336563110352,
+ 0.9998542070388794,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutCubic",
+ "values": [
+ 0.0,
+ 0.0005831754533573985,
+ 0.004665403626859188,
+ 0.015745732933282852,
+ 0.037323229014873505,
+ 0.07289692759513855,
+ 0.12596586346626282,
+ 0.2000291496515274,
+ 0.29858583211898804,
+ 0.4251348674297333,
+ 0.5748652219772339,
+ 0.701414167881012,
+ 0.799970805644989,
+ 0.8740341663360596,
+ 0.9271030426025391,
+ 0.9626767635345459,
+ 0.9842542409896851,
+ 0.9953345656394958,
+ 0.9994168281555176,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInQuart",
+ "values": [
+ 0.0,
+ 7.673361324123107e-06,
+ 0.0001227737811859697,
+ 0.000621542043518275,
+ 0.0019643804989755154,
+ 0.004795850720256567,
+ 0.0099446726962924,
+ 0.018423737958073616,
+ 0.031430087983608246,
+ 0.05034491792321205,
+ 0.07673361152410507,
+ 0.11234566569328308,
+ 0.1591147631406784,
+ 0.2191588580608368,
+ 0.29477980732917786,
+ 0.38846391439437866,
+ 0.5028814077377319,
+ 0.640886664390564,
+ 0.8055186867713928,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutQuart",
+ "values": [
+ 0.0,
+ 0.19448131322860718,
+ 0.35911333560943604,
+ 0.49711859226226807,
+ 0.6115361452102661,
+ 0.7052202224731445,
+ 0.7808411121368408,
+ 0.8408852219581604,
+ 0.8876543045043945,
+ 0.9232664108276367,
+ 0.9496551156044006,
+ 0.9685699343681335,
+ 0.9815762639045715,
+ 0.9900553226470947,
+ 0.9952041506767273,
+ 0.9980356097221375,
+ 0.9993784427642822,
+ 0.9998772144317627,
+ 0.999992311000824,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutQuart",
+ "values": [
+ 0.0,
+ 6.138689059298486e-05,
+ 0.0009821902494877577,
+ 0.0049723363481462,
+ 0.015715043991804123,
+ 0.038366805762052536,
+ 0.0795573815703392,
+ 0.14738990366458893,
+ 0.25144070386886597,
+ 0.4027593433856964,
+ 0.597240686416626,
+ 0.748559296131134,
+ 0.8526100516319275,
+ 0.9204426407814026,
+ 0.9616332054138184,
+ 0.9842849373817444,
+ 0.9950276613235474,
+ 0.9990178346633911,
+ 0.9999386072158813,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInQuint",
+ "values": [
+ 0.0,
+ 4.038611223222688e-07,
+ 1.2923555914312601e-05,
+ 9.813821088755503e-05,
+ 0.00041355378925800323,
+ 0.001262066070921719,
+ 0.003140422748401761,
+ 0.006787692662328482,
+ 0.013233721256256104,
+ 0.023847592994570732,
+ 0.04038611426949501,
+ 0.06504222750663757,
+ 0.10049352794885635,
+ 0.1499508023262024,
+ 0.2172061651945114,
+ 0.3066820502281189,
+ 0.4234790802001953,
+ 0.5734248757362366,
+ 0.7631229758262634,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutQuint",
+ "values": [
+ 0.0,
+ 0.23687702417373657,
+ 0.4265751242637634,
+ 0.5765209197998047,
+ 0.6933180093765259,
+ 0.7827938199043274,
+ 0.8500491976737976,
+ 0.8995064496994019,
+ 0.93495774269104,
+ 0.9596138596534729,
+ 0.9761524200439453,
+ 0.9867662787437439,
+ 0.9932122826576233,
+ 0.9968595504760742,
+ 0.9987379312515259,
+ 0.9995864629745483,
+ 0.9999018907546997,
+ 0.9999870657920837,
+ 0.9999995827674866,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutQuint",
+ "values": [
+ 0.0,
+ 6.4617779571563005e-06,
+ 0.00020677689462900162,
+ 0.0015702113742008805,
+ 0.006616860628128052,
+ 0.020193057134747505,
+ 0.05024676397442818,
+ 0.1086030825972557,
+ 0.21173954010009766,
+ 0.3815614879131317,
+ 0.6184386014938354,
+ 0.7882604598999023,
+ 0.8913968801498413,
+ 0.9497532248497009,
+ 0.9798069596290588,
+ 0.9933831691741943,
+ 0.9984297752380371,
+ 0.9997932314872742,
+ 0.9999935626983643,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInExpo",
+ "values": [
+ 0.0,
+ 0.000430348445661366,
+ 0.0010501561919227242,
+ 0.0019428322557359934,
+ 0.0032285081688314676,
+ 0.005080194212496281,
+ 0.007747079711407423,
+ 0.011588056571781635,
+ 0.017120005562901497,
+ 0.025087375193834305,
+ 0.03656235337257385,
+ 0.05308914557099342,
+ 0.07689179480075836,
+ 0.11117352545261383,
+ 0.1605476289987564,
+ 0.23165856301784515,
+ 0.3340757191181183,
+ 0.4815816581249237,
+ 0.6940268874168396,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutExpo",
+ "values": [
+ 0.0,
+ 0.30597323179244995,
+ 0.5184183120727539,
+ 0.6659243106842041,
+ 0.7683415412902832,
+ 0.8394523859024048,
+ 0.8888264894485474,
+ 0.9231082201004028,
+ 0.9469108581542969,
+ 0.9634376764297485,
+ 0.9749126434326172,
+ 0.9828799962997437,
+ 0.9884119629859924,
+ 0.9922529458999634,
+ 0.9949197769165039,
+ 0.996771514415741,
+ 0.9980571866035461,
+ 0.9989498257637024,
+ 0.9995696544647217,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutExpo",
+ "values": [
+ 0.0,
+ 0.0005250780959613621,
+ 0.0016142540844157338,
+ 0.0038735398557037115,
+ 0.008560002781450748,
+ 0.018281176686286926,
+ 0.03844589740037918,
+ 0.0802738144993782,
+ 0.16703785955905914,
+ 0.3470134437084198,
+ 0.6529867053031921,
+ 0.832962155342102,
+ 0.9197261333465576,
+ 0.9615541100502014,
+ 0.9817188382148743,
+ 0.9914399981498718,
+ 0.9961264729499817,
+ 0.9983857870101929,
+ 0.9994748830795288,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInCirc",
+ "values": [
+ 0.0,
+ 0.0013859868049621582,
+ 0.005555570125579834,
+ 0.012544035911560059,
+ 0.022411823272705078,
+ 0.035247206687927246,
+ 0.0511707067489624,
+ 0.07034099102020264,
+ 0.0929638147354126,
+ 0.11930525302886963,
+ 0.14971083402633667,
+ 0.18463510274887085,
+ 0.22468841075897217,
+ 0.27071547508239746,
+ 0.3239350914955139,
+ 0.3862156271934509,
+ 0.4606868624687195,
+ 0.5534062385559082,
+ 0.6798546314239502,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutCirc",
+ "values": [
+ 0.0,
+ 0.3201453685760498,
+ 0.4465937912464142,
+ 0.5393131375312805,
+ 0.6137844324111938,
+ 0.6760649085044861,
+ 0.7292845249176025,
+ 0.7753115892410278,
+ 0.8153648972511292,
+ 0.8502891659736633,
+ 0.8806948065757751,
+ 0.9070361852645874,
+ 0.9296590089797974,
+ 0.9488292932510376,
+ 0.9647527933120728,
+ 0.9775881767272949,
+ 0.9874559640884399,
+ 0.9944444298744202,
+ 0.9986140131950378,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutCirc",
+ "values": [
+ 0.0,
+ 0.002777785062789917,
+ 0.011205911636352539,
+ 0.0255853533744812,
+ 0.0464819073677063,
+ 0.07485541701316833,
+ 0.11234420537948608,
+ 0.16196754574775696,
+ 0.23034343123435974,
+ 0.3399273157119751,
+ 0.6600728034973145,
+ 0.7696565389633179,
+ 0.8380323648452759,
+ 0.8876557946205139,
+ 0.9251445531845093,
+ 0.9535181522369385,
+ 0.9744146466255188,
+ 0.9887940883636475,
+ 0.9972221851348877,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInBack",
+ "values": [
+ 0.0,
+ -0.004319644533097744,
+ -0.01570308394730091,
+ -0.03178706765174866,
+ -0.05020837113261223,
+ -0.06860373914241791,
+ -0.08460991829633713,
+ -0.0958636924624443,
+ -0.10000179708003998,
+ -0.09466099739074707,
+ -0.07747805118560791,
+ -0.04608974978327751,
+ 0.0018672095611691475,
+ 0.068756103515625,
+ 0.15693998336791992,
+ 0.2687823176383972,
+ 0.40664634108543396,
+ 0.5728949308395386,
+ 0.7698919773101807,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutBack",
+ "values": [
+ 0.0,
+ 0.23010802268981934,
+ 0.4271050691604614,
+ 0.5933536291122437,
+ 0.7312177419662476,
+ 0.8430600166320801,
+ 0.931243896484375,
+ 0.9981327652931213,
+ 1.046089768409729,
+ 1.077478051185608,
+ 1.094660997390747,
+ 1.1000018119812012,
+ 1.095863699913025,
+ 1.084609866142273,
+ 1.068603754043579,
+ 1.050208330154419,
+ 1.0317870378494263,
+ 1.0157030820846558,
+ 1.004319667816162,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutBack",
+ "values": [
+ 0.0,
+ -0.012279767543077469,
+ -0.0407332181930542,
+ -0.07278157025575638,
+ -0.09584605693817139,
+ -0.09734789282083511,
+ -0.06470834463834763,
+ 0.014651420526206493,
+ 0.15331025421619415,
+ 0.3638467788696289,
+ 0.6361533403396606,
+ 0.846689760684967,
+ 0.9853485226631165,
+ 1.0647083520889282,
+ 1.0973478555679321,
+ 1.0958460569381714,
+ 1.0727815628051758,
+ 1.0407332181930542,
+ 1.012279748916626,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInBounce",
+ "values": [
+ 0.0,
+ 0.015235483646392822,
+ 0.018178701400756836,
+ 0.058171749114990234,
+ 0.05626732110977173,
+ 0.012465357780456543,
+ 0.10439753532409668,
+ 0.19390588998794556,
+ 0.24151664972305298,
+ 0.2472299337387085,
+ 0.21104568243026733,
+ 0.13296395540237427,
+ 0.012984812259674072,
+ 0.24584490060806274,
+ 0.4762811064720154,
+ 0.6648200750350952,
+ 0.8114612102508545,
+ 0.9162049293518066,
+ 0.9790512919425964,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutBounce",
+ "values": [
+ 0.0,
+ 0.020948754623532295,
+ 0.08379501849412918,
+ 0.18853877484798431,
+ 0.3351800739765167,
+ 0.5237188935279846,
+ 0.7541550993919373,
+ 0.9870153069496155,
+ 0.8670360445976257,
+ 0.7889543175697327,
+ 0.7527700662612915,
+ 0.758483350276947,
+ 0.8060941100120544,
+ 0.8956024646759033,
+ 0.9875346422195435,
+ 0.9437326788902283,
+ 0.9418282508850098,
+ 0.9818212985992432,
+ 0.9847645163536072,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutBounce",
+ "values": [
+ 0.0,
+ 0.009089350700378418,
+ 0.028133660554885864,
+ 0.05219876766204834,
+ 0.12075832486152649,
+ 0.10552284121513367,
+ 0.006492406129837036,
+ 0.2381405532360077,
+ 0.40573060512542725,
+ 0.4895256459712982,
+ 0.5104743838310242,
+ 0.5942693948745728,
+ 0.7618592977523804,
+ 0.9935076236724854,
+ 0.894477128982544,
+ 0.8792417049407959,
+ 0.9478012323379517,
+ 0.9718663692474365,
+ 0.9909106492996216,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInElastic",
+ "values": [
+ 0.0,
+ 0.0007692781509831548,
+ 0.0020133983343839645,
+ 0.0010229836916550994,
+ -0.002845884533599019,
+ -0.005823449697345495,
+ -0.0016709592891857028,
+ 0.009906330145895481,
+ 0.016350632533431053,
+ 0.0007174967904575169,
+ -0.03298310190439224,
+ -0.04438737407326698,
+ 0.010685150511562824,
+ 0.10597081482410431,
+ 0.1156652569770813,
+ -0.06937772035598755,
+ -0.33016079664230347,
+ -0.2855096757411957,
+ 0.31351152062416077,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutElastic",
+ "values": [
+ 0.0,
+ 0.6864888668060303,
+ 1.2855095863342285,
+ 1.3301608562469482,
+ 1.0693774223327637,
+ 0.8843347430229187,
+ 0.8940292000770569,
+ 0.98931485414505,
+ 1.0443873405456543,
+ 1.0329830646514893,
+ 0.9992824792861938,
+ 0.9836493730545044,
+ 0.9900936484336853,
+ 1.0016709566116333,
+ 1.0058234930038452,
+ 1.0028458833694458,
+ 0.99897700548172,
+ 0.9979866147041321,
+ 0.9992307424545288,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutElastic",
+ "values": [
+ 0.0,
+ 0.0010101129300892353,
+ 5.789031638414599e-05,
+ -0.004322048742324114,
+ -0.0020578065887093544,
+ 0.017735587432980537,
+ 0.016276365146040916,
+ -0.06950058788061142,
+ -0.09911832213401794,
+ 0.25756508111953735,
+ 0.7424352169036865,
+ 1.0991183519363403,
+ 1.0695006847381592,
+ 0.9837236404418945,
+ 0.9822643995285034,
+ 1.0020577907562256,
+ 1.0043220520019531,
+ 0.9999421238899231,
+ 0.9989898800849915,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutBack(3)",
+ "values": [
+ 0.0,
+ 0.29144179821014404,
+ 0.5365214347839355,
+ 0.7387374043464661,
+ 0.9015892148017883,
+ 1.0285756587982178,
+ 1.123195767402649,
+ 1.1889488697052002,
+ 1.229333758354187,
+ 1.2478495836257935,
+ 1.247995376586914,
+ 1.2332701683044434,
+ 1.2071731090545654,
+ 1.1732031106948853,
+ 1.134859323501587,
+ 1.095640778541565,
+ 1.0590465068817139,
+ 1.0285756587982178,
+ 1.007727026939392,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInBack(0.5)",
+ "values": [
+ 0.0,
+ -0.001166350906714797,
+ -0.0037906402722001076,
+ -0.006560722831636667,
+ -0.008164456114172935,
+ -0.00728969182819128,
+ -0.0026242907624691725,
+ 0.0071438951417803764,
+ 0.023327011615037918,
+ 0.04723721370100975,
+ 0.080186627805233,
+ 0.12348739057779312,
+ 0.17845164239406586,
+ 0.24639162421226501,
+ 0.3286193013191223,
+ 0.4264470338821411,
+ 0.5411867499351501,
+ 0.6741507053375244,
+ 0.8266512155532837,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutBack(2.5)",
+ "values": [
+ 0.0,
+ -0.018315352499485016,
+ -0.06203528493642807,
+ -0.11432059109210968,
+ -0.15833213925361633,
+ -0.17723064124584198,
+ -0.1541770100593567,
+ -0.07233195006847382,
+ 0.08514354377985,
+ 0.3350890576839447,
+ 0.6649112105369568,
+ 0.9148564338684082,
+ 1.0723319053649902,
+ 1.154176950454712,
+ 1.1772305965423584,
+ 1.158332109451294,
+ 1.1143206357955933,
+ 1.062035322189331,
+ 1.018315315246582,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeOutElastic(1.5, 0.4)",
+ "values": [
+ 0.0,
+ -0.04138147830963135,
+ 0.5026607513427734,
+ 1.0342859029769897,
+ 1.2720074653625488,
+ 1.239296317100525,
+ 1.093928575515747,
+ 0.9729785919189453,
+ 0.9293043613433838,
+ 0.9465368986129761,
+ 0.9837990403175354,
+ 1.010536789894104,
+ 1.0177202224731445,
+ 1.011586308479309,
+ 1.002354383468628,
+ 0.9966286420822144,
+ 0.9956942200660706,
+ 0.9975756406784058,
+ 0.99979567527771,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInElastic(2, 0.2)",
+ "values": [
+ 0.0,
+ -0.0025439385790377855,
+ -0.0014205676270648837,
+ 0.00561482785269618,
+ 0.001611099811270833,
+ -0.012030133046209812,
+ -0.0004803466727025807,
+ 0.025068480521440506,
+ -0.004966647829860449,
+ -0.05081837251782417,
+ 0.02239052765071392,
+ 0.10008707642555237,
+ -0.07025231420993805,
+ -0.19090071320533752,
+ 0.19113466143608093,
+ 0.3505219519138336,
+ -0.47985148429870605,
+ -0.6129499077796936,
+ 1.1411633491516113,
+ 1.0
+ ]
+ },
+ {
+ "easing": "easeInOutElastic(1.2, 0.3)",
+ "values": [
+ 0.0,
+ 0.0009327910374850035,
+ -0.0024482598528265953,
+ 0.0020016927737742662,
+ 0.005616190377622843,
+ -0.022411569952964783,
+ 0.030899155884981155,
+ 0.020513689145445824,
+ -0.1833530217409134,
+ 0.36222559213638306,
+ 0.6377748250961304,
+ 1.183353066444397,
+ 0.9794864654541016,
+ 0.969100832939148,
+ 1.022411584854126,
+ 0.9943838119506836,
+ 0.9979982972145081,
+ 1.0024482011795044,
+ 0.9990671873092651,
+ 1.0
+ ]
+ }
+ ]
+}