* Fast-forward or go back at a specific time. * * @param progress Time (in percent) at which the player should render the animation * @returns
(progress: number)
| 172 | * @returns |
| 173 | */ |
| 174 | seek(progress: number) { |
| 175 | this.pause(); |
| 176 | |
| 177 | if (!this.rules.length) { |
| 178 | console.warn("Animation: Can't without a definition"); |
| 179 | return; |
| 180 | } |
| 181 | |
| 182 | progress = Math.max(0, Math.min(progress, 1)); |
| 183 | const time = Math.round(progress * this._duration); |
| 184 | |
| 185 | this.updateFrame(time); |
| 186 | this.completed = progress === 1; |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Go forward in time. |
no test coverage detected