Skip to content

animation.createClip#startTime

Summary

animation.createClip#startTime and endTime describe the endpoints of the clip's sampling interval in seconds. Use them to map normalized progress to clip time, including for assets whose first key is after zero.

Syntax

readonly AnimationClip.startTime: number
readonly AnimationClip.endTime: number
readonly AnimationClip.name: string
readonly AnimationClip.samplerCount: number
readonly AnimationClip.channelCount: number
const midpoint = clip.startTime + clip.duration / 2;

Example

const clip = wgpu.animation.createClip({
    name: "sample", samplerCount: 0, channelCount: 0,
    samplersPtr: 0, channelsPtr: 0, startTime: 1, endTime: 3
});
const progress = 0.5;
clip.sample(clip.startTime + progress * clip.duration); // Samples at 2 seconds.
clip.dispose();

Notes

The name and the sampler and channel counts describe the clip's declared metadata. The player starts at startTime. Looping uses the interval [startTime, endTime) and non-looping playback can sample endTime.

See Also