MotionScript

@motion-script/core


@motion-script/core / integrateSpeedToSceneTime

Function: integrateSpeedToSceneTime()

integrateSpeedToSceneTime(speed, sourceLength, upper?, step?): number

Defined in: attributes/audio/filters/curve.ts:286

Scene-time duration consumed by playing the source under a (possibly time-varying) speed curve: ∫₀^upper 1/speed(τ) dτ.

The speed curve is authored over the full sourceLength (its segment times are seconds from the clip's source start), so it is always resolved against sourceLength; upper is just the integration bound (defaults to the whole source). A slower instant (speed < 1) consumes more scene time. Sampled at INTEGRATION_STEP; speed is clamped to a tiny positive floor so a zero/negative speed can't blow up the integral.

Use this in BOTH the core scene-duration math and the cross-scene end resolution so the timeline reserves exactly the span the renderer plays.

Parameters

speed

Curve

sourceLength

number

upper?

number = sourceLength

step?

number = INTEGRATION_STEP

Returns

number