@motion-script/core / resolveVideoTimestamp
Function: resolveVideoTimestamp()
resolveVideoTimestamp(
fill,elapsed,sourceDuration?):number
Defined in: attributes/shape/fill/implementations/video.ts:100
The source time a video fill paints at, given elapsed — how long the node
painting it has existed (NodeRenderState.elapsed).
A pure function of the fill and the clock, called by the backend as it paints,
the same way a motion blur is resolved against the node's sampled velocity.
Deriving it at draw time (rather than advancing a stored timestamp each tick)
is what lets a video fill play anywhere paint is accepted — stroke, shadow,
text selection, a custom node's raw Graphics — instead of only on the two
nodes that remembered to update it. It also makes frame N identical however
the playhead reached it, so scrubbing and export agree with playback.
sourceDuration is the clip's real length in seconds, used to resolve the
trimEnd default and the loop cycle. Pass undefined (or a non-positive
value) when it isn't known yet — playback then runs linearly and unlooped,
which is what a decoder that hasn't opened the container can honour anyway.
Parameters
fill
elapsed
number
sourceDuration?
number
Returns
number