* For a given elapsed time relative to the start of the tween, calculates the value at that time and calls the * `callback` function with that value. If the given time is during the `delay` period, the callback will not be * invoked. * @param {number} time
(time)
| 59 | * @param {number} time |
| 60 | */ |
| 61 | gotoElapsedTime(time) { |
| 62 | let duration = this.duration |
| 63 | let delay = this.delay |
| 64 | if (time >= delay) { |
| 65 | time = Math.min(time, this.totalElapsed) - delay //never go past final value |
| 66 | let progress = (time % duration) / duration |
| 67 | if (progress === 0 && time !== 0) progress = 1 |
| 68 | progress = this.easing(progress) |
| 69 | if (this.direction === 'reverse' || (this.direction === 'alternate' && Math.ceil(time / duration) % 2 === 0)) { |
| 70 | progress = 1 - progress |
| 71 | } |
| 72 | this.callback(this.interpolate(this.fromValue, this.toValue, progress)) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Like `gotoElapsedTime` but goes to the very end of the tween. |
no outgoing calls