Motion
Beta The motion API may change.
A chart update should be readable. When the spec changes, marks move to the new values. The motion is 320ms ease-out, and it is off unless the spec asks for it. The agent sends a new spec to update(). It does not write tweens, keys, or durations per mark.
{ "motion": "auto" }
{ "motion": "none" }
{ "motion": { "duration": 280 } }Omitted and "none" are off, including every spec that already exists. "auto" is 320ms, CSS ease-out. A duration is clamped to 0–800ms, and 0 is off. render() and export ignore motion and return the settled SVG, so server render and PNG or SVG export stay still. prefers-reduced-motion: reduce snaps. Morphs stop above 2,000 rows. A pointer down during the ease snaps to the new spec.
Identity comes from the data. Bars, slices, and category labels are keyed by the category. A repeated label becomes Oak, then Oak#2. A line series is keyed by its field. The renderers stamp data-ck-key on the marks. The attribute does not animate.
When a bar, slice, or short line keeps its key and its number changes, the chart writes the percent, (next − previous) / |previous|, in an HTML label. The label is not in the SVG, so export does not keep it. One polite summary is announced. Reduced motion skips it.
Value change
Harbor goes from 50 to 56. That is +12%. The other bars stay.
Sort
Each bar keeps its category and slides to the new order. Labels that pass take opposite lanes, so they do not draw through each other.
Series
Adding rush draws it on. April is 56, above the previous scale. The line appears as the axis makes room, instead of sitting on the top edge. Removing the series fades it. The shared lines and the y ticks move with the new scale.
Stream
12,000 samples, 18 new ones each frame. The first frame draws the axes. Later frames stroke the polyline on the canvas. This is not the SVG morpher. The line under the chart is this browser.
Measured here, headless Chrome, window 1280×900, esbuild minify and gzip level 9, the same method as npm run size. The motion module alone is 4,478 bytes gzip. The minimal line bundle is 32,621 bytes gzip and does not include it. A 12,000-point window painted in 0.20 ms median, and the frame gap was 16.7 ms median.
Measuring the stroke in this browser.
Limits
- Morphs stop above 2,000 rows. Past that,
update()snaps. - A line whose commands change, a null break, a curve change, or a different vertex count, snaps that series.
- Color follows series order. Removing a middle series recolors the ones that remain.
- Canvas charts do not morph marks. A same-length window strokes only while the new samples stay inside the first scale.
- One curve, ease-out. Duration is the only knob, and it clamps at 800ms.
Line chart race
A race is a different motion. The line draws forward, the time axis grows from a fixed left edge, and the value axis rises with the leader. motion cannot express that. It morphs two finished specs, and render() ignores it. createLineRace() takes the rows, and frame(t) returns the SVG at t from 0 to 1. Playback and export call that same function. The builder is on the line chart race page. Odds replay, createOddsReplay(), holds each price until the next row and exports through the same function. It opens at /race?type=odds.