Skip to main content

getCanvasKeyframeSettingsChange()v4.0.530

Returns the change that writes the interpolate() options of a keyframed prop: the extrapolation, the output mode and posterize.

warning

Experimental API: This package is not stable. Its public API may change without a major version bump.

PosterizeField.tsx
export const PosterizeField = () => { const settings = getCanvasKeyframeSettings(propStatus); return ( <input type="number" min={0} value={settings.posterize ?? 0} onChange={(event) => { const posterize = Number(event.target.value); persist( getCanvasKeyframeSettingsChange({ nodePathInfo, schema, key: 'style.opacity', propStatus, settings: {...settings, posterize: posterize > 0 ? posterize : null}, }), ); }} /> ); };

Parameters​

An object with the following properties:

nodePathInfo​

The SequenceNodePathInfo of the sequence, from a track or a selection item. It is passed through to the returned change.

schema​

The interactivity schema of the element, from track.sequence.controls.

key​

The schema key of the prop in dot notation, for example 'style.opacity'.

propStatus​

The 'keyframed' prop status of the prop, as the props of getNodeProps() report it.

settings​

The CanvasKeyframeSettings to write. Take the object returned by getCanvasKeyframeSettings() and replace the values that changed. Options the interpolation function does not have are left as they are, and a posterize of null or 0 removes the option. Only offer the extrapolateTypes of the settings: interpolatePaths() rejects 'identity'.

Return value​

A CanvasKeyframeChange whose operation is {type: 'settings', clamping, posterize, output}. Persist it with updateNodeKeyframes() like the changes of getCanvasKeyframeToggle(), and pass it to getCanvasKeyframeChangeOverride() to show the result on the canvas right away.

Compatibility​

BrowsersEnvironments
Chrome
Firefox
Safari

See also​