Values

Every field of a layer, such as a place's scale, a look's opacity or a content's text, takes a value. A value is a number written once, or a form that works out a number, a text or a list again on every frame. This page shows each form in use, the time modifiers on, loop and hold, how names are looked up, roles and swatches, the values layers report for links, and the errors a value can raise.

One bar, five values

The five bars below are the same kind of layer, an HTML element scaled along its width. Each one gets its scale from a different value form: a track, keys, a rate, a track with a wiggle added, and a stagger that starts eight cells one after another. The sections after the example take each form in turn.

<div data-composition-id="main" data-start="0" data-duration="5" data-width="1280" data-height="720" data-fps="30">
    <div class="board" data-component="bars" data-start="0" data-duration="5">
        <div class="row"><span>Track</span><div class="bar" id="track"></div></div>
        <div class="row"><span>Keys</span><div class="bar" id="keys"></div></div>
        <div class="row"><span>Rate</span><div class="bar" id="rate"></div></div>
        <div class="row"><span>Wiggle</span><div class="bar" id="wiggle"></div></div>
        <div class="row"><span>Stagger</span>
            <div class="cells"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div>
        </div>
    </div>
</div>
wildflower.kinetic.layers.scene('bars', {
    layers: [
        // A track: from 0 to full width between 0.5 and 2.5 seconds, eased.
        { id: 'track', kind: 'html', src: '#track',
          place: { scale: [{ at: [0.5, 2.5], to: [0, 1], ease: 'power2.out' }, 1] } },
        // Keys: up to 40%, a pause, then on to full width.
        { id: 'keys', kind: 'html', src: '#keys',
          place: { scale: [{ keys: [[0.5, 0], [1.5, 0.4], [2.5, 0.4], [3.5, 1]] }, 1] } },
        // A rate: grows by 0.2 a second, so it reaches full width at 5 seconds.
        { id: 'rate', kind: 'html', src: '#rate',
          place: { scale: [{ rate: 0.2 }, 1] } },
        // A track with a wiggle beside it: the wiggle is added to the track.
        { id: 'wiggle', kind: 'html', src: '#wiggle',
          place: { scale: [{ at: [0.5, 2.5], to: [0.1, 0.75], wiggle: { frequency: 3, amplitude: 0.06, seed: 2 } }, 1] } },
        // A stagger: each of the eight cells starts 0.25 seconds after the one before.
        { id: 'cells', kind: 'html', src: '.cells i', delay: { stagger: { each: 0.25 } },
          place: { scale: [1, { at: [0.5, 1], to: [0, 1], ease: 'back.out' }] },
          look: { opacity: { at: [0.5, 0.8], to: [0, 1] } } },
    ],
});
html, body { margin: 0; background: #0a0b10; }

[data-composition-id] { position: relative; overflow: hidden; background: #10141f; font-family: system-ui, sans-serif; }

.board { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 36px; padding: 0 120px; }

.row { display: flex; align-items: center; gap: 32px; }
.row span { width: 160px; font-size: 30px; font-weight: 600; color: #c9d1e3; }

.bar { width: 840px; height: 56px; border-radius: 8px; background: #f2b134; transform-origin: left center; }
#keys { background: #7c8cff; }
#rate { background: #5fc8d8; }
#wiggle { background: #ff7a8a; }

.cells { display: flex; gap: 8px; }
.cells i { width: 98px; height: 56px; border-radius: 8px; background: #8fd18a; }

[data-composition-id]:not([data-kinetic-ready]) { visibility: hidden; }
One bar, five values

scale takes a list of two values, the width's scale and the height's, and each item of the list is a value of its own. So [{ rate: 0.2 }, 1] grows the width and keeps the height at 1. Every time in a value counts from the start of the clip the layer is on, in seconds unless the scene's unit is 'frame'.

Numbers, names and sums

A number is used as it is.

{ id: 'card', kind: 'html', src: '.card', look: { opacity: 0.6 } }

The card shows at 60% opacity for its whole life.

A string is a name when the scene defines that name, such as one of its constants.

constants: { OUT: 1.2, R: 40 },
layers: [
    { id: 'card', kind: 'html', src: '.card', place: { translate: [0, 'R'] } },
]

The card sits 40 px below where the CSS puts it.

A string can also be a sum of names and numbers, joined by + or - with a space on each side of the sign. A number written right before a name multiplies it.

{ id: 'card', kind: 'html', src: '.card', life: [0, 'OUT + 2'], place: { translate: [0, '0.6R'] } }

The card sits 24 px down, 0.6 times R, and disappears at 3.2 seconds, two seconds after OUT. Markers and beats go in sums too, as in 'drop - 0.5', half a second before the marker drop, and 'beat 8', the time of beat 8 (Markers and tempo). A beat takes a fraction, so 'beat 8.5' is halfway to beat 9.

A sum has no * or /. A number times a name is written with the number straight before it, '7value', and a product of two names is { multiply: ['w', 'value'] } (below).

Any other string stays a string. That is how a field takes a color, an ease, a class or a word.

{ id: 'label', kind: 'html', src: '.label', content: { text: 'tall grass' }, look: { style: { color: '#ff3366' } } }

The label reads "tall grass" in pink. A name the scene does not define also stays a string, so a misspelled name shows up as that text, or as a CSS value the browser ignores.

Lists

A list is a list of values, and each item can be any form.

place: { translate: [0, { at: [0, 1], to: [40, 0] }] }

The element stays where it is across and rises 40 px into place over the first second.

Tracks: { at, to }

A track is a list of times, at, and a list of values to reach at those times, to. Between two times the value moves from one to the next, and before the first time and after the last it holds the end values. It is read the way interpolate() reads it, with the same ease and extrapolate options.

look: { opacity: { at: [0, 0.5, 3.5, 4], to: [0, 1, 1, 0], ease: 'ease-in-out' } }

The element fades in over half a second, stays, and fades out over the last half second of four.

place: { translate: [0, { at: [0, 1, 2], to: [0, -100, 0], ease: 'smooth' }] }

ease: 'smooth' draws one curve through three or more keys, so the element rises 100 px and comes back down in one arc, without a stop at the top. Each item of at and to is a value too, so a time can be a name or a sum, such as at: ['OUT', 'OUT + 0.5'].

Keys: { keys }

Keys are pairs, [x, value]. The value moves in a straight line from one key to the next, and holds the first value before the first key and the last value after the last key.

look: { opacity: { keys: [[0.5, 0], [1.5, 1]] } }

The element is hidden until half a second, then fades in over one second.

ease eases each stretch between two keys. A key written [x, ['hold', v]] holds v until the next key, and then jumps to that key's value.

content: { text: { keys: [[0, ['hold', 10]], [1, 20], [2, 40]] } }

The text shows 10 for the first second, jumps to 20 at one second, and counts up to 40 by two seconds.

By default x is the time. With by, x is any other value, such as a store's field or a shared value.

stores: ['dial'],
layers: [
    { id: 'needle', kind: 'html', src: '.needle', place: { rotate: { keys: [[0, -90], [100, 90]], by: 'dial.level' } } },
]

The needle turns from -90 to 90 degrees as dial.level goes from 0 to 100, whatever the time, and sits at 0 degrees when the level is 50.

Keys blend colors, and a color can be a name in swatches or roles.

swatches: { ink: '#1b1f2a', sun: '#f2b134' },
layers: [
    { id: 'disc', kind: 'svg', src: '.disc', content: { fill: { keys: [[0, 'ink'], [2, 'sun']] } } },
]

The SVG disc turns from near black to yellow over two seconds.

Keys whose values are SVG paths morph one shape into the next. match takes matchPaths()'s options, and {} takes its defaults.

{ id: 'wave', kind: 'svg', src: '.wave', content: { d: { keys: [[0, 'M0 0 L100 100'], [2, 'M0 100 L100 0']], match: {} } } }

The line tips from falling to rising over two seconds.

A link reads a value from somewhere else. from is a path: the first part says where to look, and the rest is the field.

Another layer's field, read at the same moment, is the layer's id and the path to the field.

{ id: 'lead', kind: 'html', src: '.lead', look: { opacity: { at: [0, 2], to: [0, 1] } } },
{ id: 'echo', kind: 'html', src: '.echo', look: { opacity: { from: 'lead.look.opacity', time: -0.5 } } }

The echo fades in exactly as the lead does, half a second behind it, because time reads the value that much earlier, or later for a positive number. A link finds layers in its own comp and in the comps that contain it.

scale multiplies what the link reads and add adds to it; with a list of numbers, each one is scaled and added to.

{ id: 'shadow', kind: 'html', src: '.shadow', place: { translate: [{ from: 'ball.place.translate.0', scale: 0.5, add: 20 }, 0] } }

The shadow starts 20 px to the right and moves half as far as the ball.

The other sources each start with a word or a name the scene lists.

{ from: 'params.label' }     // a comp's parameter, or a field of a copy's row
{ from: 'inputs.headline' }  // one of the scene's inputs
{ from: 'props.role' }       // the clip's data-prop-role, declared in props
{ from: 'dial.angle' }       // the field angle of the store dial, listed in stores
{ from: 'sales.rows' }       // the rows of the query sales, listed in queries
  • params reads a parameter of the comp the layer is in, or a field of the row a repeated copy was made from.
  • inputs reads a composition variable that the scene's inputs declares (inputs). An input that fails its check raises KN-130 once and reads as undefined.
  • props reads the clip's own data-prop-* attribute, declared in the scene's props, so each clip that uses the scene shows its own value.
  • A store's name reads that store's field. The store goes in the scene's stores, and the scene draws again when the field changes while the clock stands still, such as when a learner moves a slider.
  • A query's name reads its rows or another field. The query goes in the scene's queries, and the first frame waits for its rows (Data).

Data stays as it is

A link uses what it reads unchanged. A row's '1.10' stays the text 1.10, and a label that happens to match a layer's or a marker's name stays the label.

A number written as text is still read as a number by every form that takes a number. An input's value is always text, so a slider at 42 writes '42' into its store, and { from: 'dial.level', scale: 0.01 } gives 0.42.

<div data-composition-id="main" data-start="0" data-duration="6" data-width="1280" data-height="720" data-fps="30">
    <div class="panel" data-component="readout" data-start="0" data-duration="6">
        <label class="knob">Level <input type="range" min="0" max="100" value="42"></label>
        <p class="big"></p>
        <div class="meter"><div class="fill"></div></div>
        <table class="releases">
            <thead><tr><th>{ from: 'params.version' }</th><th>'version'</th></tr></thead>
            <tbody>
                <template><tr><td class="as-link"></td><td class="as-name"></td></tr></template>
            </tbody>
        </table>
    </div>
</div>
// The slider writes its value into a store as text, as every input does.
wildflower.store('dial', { state: { level: '42' } });
document.querySelector('.knob input').addEventListener('input', (e) => {
    wildflower.getStore('dial').level = e.target.value;
});

wildflower.kinetic.layers.scene('readout', {
    stores: ['dial'],
    comps: {
        release: {
            layers: [
                { id: 'row', kind: 'html', src: ':scope', look: { opacity: { at: [0, 0.4], to: [0, 1] } } },
                // A link reads the row's field as it is written.
                { id: 'link', kind: 'html', src: '.as-link', content: { text: { from: 'params.version' } } },
                // A name (in a one-item list, since a string on its own is the text) reads it as a number when it is one.
                { id: 'name', kind: 'html', src: '.as-name', content: { text: ['version'] } },
            ],
        },
    },
    layers: [
        // The text '42', shown as it is.
        { id: 'big', kind: 'html', src: '.big', content: { text: { from: 'dial.level' } } },
        // The same text used as a number: scaled to 0.42, then multiplied by a track that grows in.
        { id: 'fill', kind: 'html', src: '.fill',
          place: { scale: [{ multiply: [{ from: 'dial.level', scale: 0.01 }, { at: [0, 1], to: [0, 1], ease: 'power2.out' }] }, 1] } },
        { id: 'releases', kind: 'comp', comp: 'release', src: '.releases tbody', start: { stagger: { each: 0.3 } },
          repeat: { over: [{ version: '1.10' }, { version: '1.9' }, { version: '0.2.0' }] } },
    ],
});
html, body { margin: 0; background: #0a0b10; }

[data-composition-id] { position: relative; overflow: hidden; background: #10141f; color: #e8ecf6; font-family: system-ui, sans-serif; }

.panel { position: absolute; inset: 0; padding: 80px 120px; }

.knob { display: flex; align-items: center; gap: 24px; font-size: 28px; color: #c9d1e3; }
.knob input { width: 420px; accent-color: #f2b134; }

.big { margin: 32px 0 16px; font-size: 120px; font-weight: 800; line-height: 1; }

.meter { width: 1040px; height: 40px; border-radius: 8px; background: #1d2433; }
.fill { width: 100%; height: 100%; border-radius: 8px; background: #f2b134; transform-origin: left center; }

.releases { margin-top: 48px; border-collapse: collapse; font-size: 34px; }
.releases th { padding: 0 64px 12px 0; text-align: left; font: 500 24px ui-monospace, monospace; color: #8b95ad; }
.releases td { padding: 8px 64px 8px 0; font-family: ui-monospace, monospace; }

[data-composition-id]:not([data-kinetic-ready]) { visibility: hidden; }
Data stays as it is

The big number shows the store's text, 42, and the meter fills to 42% of its width. Move the slider and both change at once, while the clock stands still or plays.

The table shows the difference between a link and a name. The link column shows each row's version exactly as written: 1.10, 1.9 and 0.2.0. The name column reads the same field by its name, ['version'], which works it out as a number, so 1.10 becomes 1.1. 0.2.0 is no number, so the name column shows the word version itself, as any string that does not work out stays a string. To show a row's text, read it with a link.

Followers: { follow }

A follower eases toward a store's field by a spring, instead of jumping to each new value.

stores: ['dial'],
shared: { angle: { follow: 'dial.angle', ease: { spring: { duration: 0.6, bounce: 0.2 } } } },
layers: [
    { id: 'needle', kind: 'html', src: '.needle', place: { rotate: 'angle' } },
]

When the learner sets a new angle, the needle swings to it over about 0.6 seconds and overshoots a little. Kinetic draws the scene again on each animation frame while the spring moves, also while a lesson holds the clock (follow). The store's field must hold a number, or true or false, which follow as 1 and 0.

Functions: { call }

A call runs one of the functions handed to the scene in fns, with the values of args as its arguments.

wildflower.kinetic.layers.scene('orbit', {
    layers: [
        { id: 'moon', kind: 'html', src: '.moon', place: { translate: [
            { call: 'orbitX', args: [{ rate: 1 }], scale: 200 },
            { call: 'orbitY', args: [{ rate: 1 }], scale: 200 },
        ] } },
    ],
}, { fns: { orbitX: (t) => Math.cos(t), orbitY: (t) => Math.sin(t) } });

The moon circles its resting place on a 200 px radius, once every 6.3 seconds. scale and add work on a number the function returns, and a text or a list it returns is used as it is. A function gets the time only as one of its arguments, here { rate: 1 }, and must not read the clock or call Math.random(), so every frame draws the same way each time.

Products, sums, smallest, largest and floor

look: { opacity: { multiply: ['fadeIn', 'fadeOut'] } }

The opacity is the product of two shared values, so the element fades in with one and out with the other.

place: { translate: [{ add: [100, { rate: 40 }] }, 0] }

add with a list is the sum, so the element starts 100 px to the right and drifts 40 px further each second.

place: { scale: { min: [1, { rate: 0.5 }] } }

The element grows from nothing and stops at full size after two seconds, the smaller of 1 and the growing value. { max: [...] } takes the largest instead.

content: { text: { floor: { rate: 1 } } }

The text counts the whole seconds, 0, 1, 2, and so on.

Rates: { rate }

place: { rotate: { rate: 90 } }

The element turns 90 degrees a second from the clip's start, without end. { rate: n } grows by n a second from time 0, so { rate: 1 } is the time itself, in seconds.

Stagger and sweep

When a layer's src finds several elements, each one is worked out with its own i, its place among them from 0, and n, how many there are. Repeated copies and the parts of a split text have an i of n too. { stagger } gives stagger(i, n, options) for each one.

{ id: 'dots', kind: 'html', src: '.dot', delay: { stagger: { each: 0.1, from: 'center' } },
  look: { opacity: { at: [0, 0.3], to: [0, 1] } } }

The dots fade in from the middle outward, a tenth of a second apart.

{ id: 'cells', kind: 'html', src: '.cell', look: { opacity: { sweep: { p: { at: [0, 4], to: [0, 1] }, width: 0.4 } } } }

{ sweep: { p, ... } } gives sweep(i, n, p, options), so the cells light up one after another as p runs from 0 to 1 over four seconds.

The music: level, spectrum and beat

These forms read the music at the current time (Audio).

place: { scale: { add: [1, { level: 'bass' }] } }

The element swells with the bass, from its own size up to twice it. { level: { band, clip } } reads one audio clip alone, by its id.

{ id: 'bars', kind: 'html', src: '.bar', place: { scale: [1, { spectrum: { bins: 16 } }] } }

Sixteen bars become a spectrum, bass on the left, each one as tall as its bin's level. Each element reads the bin at its own i, and bins defaults to n.

place: { scale: { add: [1, { multiply: [0.2, { beat: { beats: { from: 'beats.rows' }, decay: 0.3 } }] }] } }

The element jumps 20% bigger on each beat of a beat file read by the query beats, and settles back over about 0.3 seconds (beat()). beats can also be the list of beats written in the scene.

Noise added to a value: { wiggle }

place: { rotate: { wiggle: { frequency: 2, amplitude: 5, seed: 1 } } }

The element rocks between -5 and 5 degrees, with a new value every half second, as wiggle() gives it.

Written as a key beside another form, the wiggle is added to that form's value.

place: { translate: [{ at: [0, 2], to: [0, 600], wiggle: { frequency: 3, amplitude: 12, seed: 4 } }, 0] }

The element slides 600 px to the right and shakes along the way. The wiggle always reads the real time, even when on, loop or hold change the time the rest of the value is read at.

Clip times: { startOf }

A clip's id written as a name is the time that clip ends. { startOf: 'id' } is the time it starts. Both count from the start of the clip the layer is on.

{ id: 'caption', kind: 'html', src: '.caption', life: [{ startOf: 'intro' }, 'intro'] }

The caption shows exactly while the clip #intro runs.

Focus: { focus }

shared: { focusBlur: { focus: { depth: 160, max: 10 } } },
layers: [
    { id: 'cam', kind: 'camera', perspective: 1000, moves: [{ to: { z: 0 } }], focus: -600 },
    { id: 'sign', kind: 'html', band: 'world', src: '#sign', size: [400, 240], place: { position: [0, 0, 0] }, look: { blur: 'focusBlur' } },
]

The sign is blurred, because it stands 600 px in front of the camera's focus plane. A world layer at z: -600 would be sharp. { focus: { depth, max } } is the blur for a world layer's distance from the focus plane, as focus() gives it, with depth the distance either side of the plane that stays sharp and max the most blur in px (Solids, cameras and paths).

Changing the time a value is read at

Any form written as an object also takes on, loop or hold. Each one changes the time at which the rest of the value is read.

  • on: n reads the value n times a second, so it moves in steps. on: 'twos' reads it at half the frame rate, like animation drawn on twos (posterize()).
  • loop: [from, to] plays the stretch from from to to again and again, from from on.
  • hold: [at, length] stops the time at at for length seconds, then carries on from where it stopped.
<div data-composition-id="main" data-start="0" data-duration="5" data-width="1280" data-height="720" data-fps="30">
    <div class="lanes" data-component="lanes" data-start="0" data-duration="5">
        <div class="lane"><span>plain</span><i id="plain"></i></div>
        <div class="lane"><span>on: 4</span><i id="stepped"></i></div>
        <div class="lane"><span>loop: [0.5, 2]</span><i id="looped"></i></div>
        <div class="lane"><span>hold: [1.5, 1.5]</span><i id="held"></i></div>
    </div>
</div>
// One track across the lane, read four ways.
const across = { at: [0.5, 4.5], to: [0, 1000] };

wildflower.kinetic.layers.scene('lanes', {
    layers: [
        { id: 'plain', kind: 'html', src: '#plain', place: { translate: [across, 0] } },
        // Read 4 times a second, so the dot jumps in steps.
        { id: 'stepped', kind: 'html', src: '#stepped', place: { translate: [{ ...across, on: 4 }, 0] } },
        // From 0.5 seconds on, time runs from 0.5 to 2 again and again.
        { id: 'looped', kind: 'html', src: '#looped', place: { translate: [{ ...across, loop: [0.5, 2] }, 0] } },
        // At 1.5 seconds the time stops for 1.5 seconds, then carries on from there.
        { id: 'held', kind: 'html', src: '#held', place: { translate: [{ ...across, hold: [1.5, 1.5] }, 0] } },
    ],
});
html, body { margin: 0; background: #0a0b10; }

[data-composition-id] { position: relative; overflow: hidden; background: #10141f; font-family: system-ui, sans-serif; }

.lanes { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 56px; padding: 0 100px; }

.lane { position: relative; height: 72px; border-bottom: 2px solid #2a3245; }
.lane span { position: absolute; left: 0; bottom: 84px; font: 500 24px ui-monospace, monospace; color: #8b95ad; }
.lane i { position: absolute; left: 0; bottom: 8px; width: 56px; height: 56px; border-radius: 50%; background: #f2b134; }

[data-composition-id]:not([data-kinetic-ready]) { visibility: hidden; }
One track read four ways

The plain dot crosses its lane in four seconds. The stepped dot follows it in jumps, four a second. The looped dot crosses the first 375 px and starts that stretch over, every 1.5 seconds. The held dot stops at 1.5 seconds, waits there for 1.5 seconds, and finishes the crossing 1.5 seconds late, so it ends the clip short of the lane's end.

How a name is looked up

A name is looked up in this order, and the first place that has it wins.

  1. The placement's parameters and a copy's row, from the innermost comp outward, with i and n among them.
  2. constants.
  3. shared.
  4. 'end', the duration, and 'last', the last frame a render captures, one frame before the end, where a fade out should finish.
  5. The composition's markers and beats, and the ids of its clips, each the time that clip ends.

Two places show a string as written instead. A string in content.text is the text itself (a one-item list, ['total'], shows a name's value). In a CSS value or an SVG attribute, 'end' and 'last' on their own are the keywords, as in 'text-anchor': 'end', since they name times only where a time goes. A name you define yourself, such as 'hubX', is read in an attribute as anywhere else.

constants: { gap: 10 },
comps: { card: { params: { gap: 2 }, layers: [
    { id: 'title', kind: 'html', src: 'h2', place: { translate: [0, 'gap'] } },
] } },

The title inside a card moves down 2 px, since the comp's parameter gap comes before the constant.

look: { opacity: { at: [0, 0.5, 'last - 0.5', 'last'], to: [0, 1, 1, 0] } }

The element fades in at the start and is fully gone on the last frame of the render.

constants are worked out once, at time 0, and read the same everywhere. shared values take any form and are worked out where they are read, so a shared track reads the time of the layer that uses it, and a shared { stagger } reads that layer's i.

Roles and swatches

swatches names colors, and roles names a use of a color, such as an accent, by a swatch's name. A comp or a placement can give a role another swatch, so one comp can be drawn in several color schemes (Comps and copies).

swatches: { teal: '#1f8a8a', rust: '#c4532d' },
roles: { accent: 'teal' },
layers: [
    { id: 'dot', kind: 'svg', src: '.dot', content: { fill: 'accent' } },
]

The SVG dot is teal. Change the role to 'rust' and every layer that uses accent turns rust.

A color name works wherever a color goes: an SVG layer's content attributes, look.color, any property in look.style, both kinds of track, a copy's or a text part's style, and a layer call's ink, paper, shadow and highlight.

look: { style: { background: { at: [0, 1], to: ['rust', 'accent'] }, borderColor: 'accent' } }

The background blends from rust to the accent, teal, and the border is teal. A string that names no swatch or role, such as 'block' or '#fff', is written as it is.

Values layers report

Some layers report values that they work out as they draw, and a link reads them by the layer's id.

{ id: 'title', kind: 'text', src: '.title', content: { text: 'Kinetic' } },
{ id: 'count', kind: 'html', src: '.count', content: { text: { from: 'title.length' } } }

The count shows 7, the number of letters in the title.

  • A text layer reports 'id.text' and 'id.length'. With captions, it also reports 'id.index', the line shown, and 'id.empty', whether the line is empty (Text layers).
  • An SVG layer reports the outline it draws as 'id.d', after a morph or a boil.
  • A look.repeat layer reports 'id.count', its number of copies, and 'id.transform', its last copy's transform (Layer calls).
  • A path layer reports 'id.head' and its progress along each stop (Solids, cameras and paths).

List a layer that reads one of these after the layer it reads. A layer listed before it finds no value on the first frame, and the link raises KN-164.

Errors in values

A value that Kinetic cannot work out stops the frame that reads it. The console shows the error with its code, the layer and what is wrong, and check() reports that a seek threw.

KN-165 is a value of the wrong shape.

look: { opacity: { fom: 'lead.look.opacity' } }    // KN-165: no value form has the key fom
look: { opacity: { keys: [[1, 0], [0.5, 1]] } }     // KN-165: keys run forward; 0.5 comes after 1
look: { opacity: { keys: [[0, ['hold']], [1, 1]] } } // KN-165: a hold holds a value, and this one has none
place: { scale: { keys: [[0, 0], [1, 'params.w']] } } // KN-165: text beside a number in a track
look: { opacity: { add: [0.5, 'params.w'] } }        // KN-165: arithmetic takes numbers, and this name finds none

The last one is the most common. A path such as 'params.w' written as a plain string is read as a name, finds nothing, and stays text, so the track has a number at one end and text at the other. Write it as a link, { from: 'params.w' }. In an { at, to } track the same mistake raises KN-120, from interpolate(). A repeat.over that gives something other than a list, and a layer call's options that gives something other than an object, are also KN-165. So is text that is no number, or a list, where rate, multiply, add, min, max, floor or a link's scale and add take a number, and an empty min, max or multiply. A function in fns that returns NaN is KN-165 too.

A few other codes come from values.

  • KN-163: a key's place in keys is a name nothing defines, or a stagger, sweep or spectrum sits on a layer with no i of n.
  • KN-164: a link reads a layer, store, query, input or prop that the scene does not have, or a field the layer does not have.
  • KN-166: a call asks for a function that is not in fns.
  • KN-169: names lead back to themselves, such as two shared values that read each other.

Every error code for layers is listed on Your first layers.

The value forms

FormMeaning
a numberItself.
a stringA name, or a sum of names and numbers joined by + or - with a space on each side of the sign, where a number written before a name multiplies it: 'OUT + R', '0.6R', 'drop - beat 1'. Any other string stays a string, such as a color, an ease or a class.
a listEach item is a value: [0, { at: [0, 1], to: [40, 0] }].
{ at, to, ease, extrapolate }A track on time, read as interpolate() reads it. ease: 'smooth' draws one curve through three or more keys.
{ keys: [[x, v], ...], by, ease, match }Moves in straight lines between keys, or eased, and holds the end values before the first key and after the last. x is the time, or the value of by. A key [x, ['hold', v]] holds v until the next key. Colors blend between keys, and path keys morph from one shape to the next, with match taking matchPaths()'s options ({} for its defaults).
{ from: 'id.path', scale, add, time }A link, which reads another layer's field or a value that layer reports, a parameter ('params.name'), an input ('inputs.name'), a prop ('props.name'), or a field of a store or a query ('dial.angle', 'sales.rows'). time reads the value at a later or earlier time. A link uses what it reads unchanged: a row's '1.10' stays that text, and a label that matches a layer's name stays the label. A number written as text, such as a slider's value, works as a number wherever a form takes one.
{ follow: 'store.path', ease }A spring that eases toward a store's value, a number or true and false. Kinetic redraws it on each animation frame while it moves, including while a lesson holds.
{ call: 'name', args, scale, add }Calls the function of that name in fns with the values of args.
{ multiply }, { add }, { min }, { max }, { floor }The product, sum, smallest or largest of a list of values, or the floor of one value.
{ rate: n }Grows by n a second from time 0, so { rate: 1 } is the time itself.
{ stagger }, { sweep: { p, ... } }The value of stagger(i, n, ...) or sweep(i, n, p, ...) for this copy, element or part.
{ level: 'bass' }, { spectrum: { bins } }, { beat: { beats, decay } }The music at the current time: a band's level, this copy's spectrum bin, or a pulse on each beat (Audio).
{ wiggle: { frequency, amplitude, seed } }The value of wiggle(). Written as a key beside another form, it is added to that form's value.
{ startOf: 'clipId' }The time a clip starts. A clip's id on its own, as a name, is the time it ends.
{ focus: { depth, max } }The blur for a world layer's distance from the camera's focus plane.
ModifierMeaning
onReads the value that many times a second, as posterize() steps the time, or 'twos' for half the frame rate.
loop: [from, to]Plays the stretch from from to to again and again.
hold: [at, length]Stops the time at at for length, then carries on.

A name is looked up in the placement's parameters and a copy's row, then constants, shared, 'end' and 'last', and then the composition's markers, beats and clip ids. A color name is looked up in roles, which gives a name in swatches.

Next: Text layers.