Skip to main content

getCanvasPropValueAtFrame()v4.0.530

Reads the value a prop has at a composition frame according to the source code. Use it to show the value of an animated prop at the playhead in an inspector.

warning

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

OpacityField.tsx
export const OpacityField = () => { const value = getCanvasPropValueAtFrame({ track, schema, key: 'style.opacity', propStatus, frame: playhead, }); return <input type="number" value={typeof value === 'number' ? value : ''} readOnly />; };

Parameters​

An object with the following properties:

track​

The TimelineTrackData of the sequence from controller.timeline. Only keyframeDisplayOffset and keyframePlaybackRate are read.

schema​

The interactivity schema of the element, from track.sequence.controls. It provides the default of an unset prop.

key​

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

propStatus​

How the prop is written in the source, as the props of getNodeProps() report it.

frame​

The composition frame at which to read the value.

Return value​

The interpolated value of a 'keyframed' prop at the frame, the code value of a 'static' prop, or the schema default when the prop is not set. null for a 'computed' prop or when no value is known.

The value reflects the source, not an active override from controller.overrides.

Compatibility​

BrowsersEnvironments
Chrome
Firefox
Safari

See also​