Play the animation.
()
| 138 | |
| 139 | /** Play the animation. */ |
| 140 | play() { |
| 141 | if (this.animationFrameId !== null) { |
| 142 | return; |
| 143 | } |
| 144 | if (!this.rules.length) { |
| 145 | console.warn("Animation: Can't play without a definition"); |
| 146 | return; |
| 147 | } |
| 148 | if (this.completed) { |
| 149 | this.reset(); |
| 150 | this.completed = false; |
| 151 | } |
| 152 | |
| 153 | this._isPlaying.set(true); |
| 154 | |
| 155 | // Start the animation. |
| 156 | this.animate(Date.now(), 0); |
| 157 | } |
| 158 | |
| 159 | /** Pause the animation. */ |
| 160 | pause() { |