Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/animation/Animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,20 @@ export default class Animation extends Eventful {
this._startLoop();
}

seek(timestamp: number) {
this._time = getTime() - timestamp;
let clip = this._head;
while(clip) {
clip.loop = true;
clip.setStartTime(this._time + clip.getDelay());
clip = clip.next;
}
this._pausedTime = 0;
this._pauseStart = getTime();
this._paused = true;
this.update();
}

/**
* Stop animation.
*/
Expand Down
8 changes: 8 additions & 0 deletions src/animation/Clip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ export default class Clip {
opts.easing && this.setEasing(opts.easing);
}

getDelay() {
return this._delay;
}

setStartTime(startTime: number) {
this._startTime = startTime;
}

step(globalTime: number, deltaTime: number): boolean {
// Set startTime on first step, or _startTime may has milleseconds different between clips
// PENDING
Expand Down