animation.createPlayer#time¶
Summary¶
animation.createPlayer#time is the playback cursor in seconds on the clip's timeline. Set it to seek, set playing to pause or resume, and adjust speed or loop to control what the next update does.
Syntax¶
AnimationPlayer.time: number
AnimationPlayer.speed: number
AnimationPlayer.loop: boolean
AnimationPlayer.playing: boolean
readonly AnimationPlayer.clip: AnimationClip
player.time = player.clip.startTime;
Example¶
const clip = wgpu.animation.createClip({
name: "sample", samplerCount: 0, channelCount: 0,
samplersPtr: 0, channelsPtr: 0, startTime: 1, endTime: 3
});
const player = wgpu.animation.createPlayer(clip);
player.playing = false;
player.time = player.clip.startTime + 0.5 * player.clip.duration;
player.clip.sample(player.time);
clip.dispose();
Notes¶
The cursor starts at clip.startTime. Assigning it changes playback state only. For immediate sampling, call clip.sample(player.time). The defaults are speed: 1, loop: true and playing: true. Negative speed plays backward. Zero speed stops advancement, but an update still wraps or clamps the cursor before sampling a positive-duration clip. Pass finite values for time and speed.