* Go back in time. * * @param timestep Custom timestep different from the config one * @returns
(timestep?: number)
| 217 | * @returns |
| 218 | */ |
| 219 | back(timestep?: number) { |
| 220 | this.pause(); |
| 221 | |
| 222 | if (!this.rules.length) { |
| 223 | console.warn("Animation: Can't go back without a definition"); |
| 224 | return; |
| 225 | } |
| 226 | timestep = timestep ?? this.config.timestep; |
| 227 | |
| 228 | const time = this.currentTime - timestep; |
| 229 | |
| 230 | if (time >= 0) { |
| 231 | this.updateFrame(time); |
| 232 | |
| 233 | // Incomplete the animation, if it was completed. |
| 234 | this.completed = false; |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | /** Reset the animation. */ |
| 239 | reset() { |
no test coverage detected