Animation · function

sampleSpring

Where the mass sits at timeSec, given where its anchor has been.

Explained in Animation.

function sampleSpring(settings: SpringSettings, anchorAt: SpringAnchor, timeSec: number, out: Vec3Out): void
import { sampleSpring } from '@driftengine/animation';

Parameters

ParameterTypeDescription
settingsSpringSettings
anchorAtSpringAnchor
timeSecnumber
outVec3Out

In depth

anchorAt is called many times per sample, at times before timeSec, and must be a pure function of the time it is handed — the same contract sampleClip holds. An anchor that reads a clock, or that answers differently on a second call for one time, breaks the property this module exists to provide and does so silently.