(value)
| 1265 | } |
| 1266 | |
| 1267 | paused(value) { |
| 1268 | if (!arguments.length) { |
| 1269 | return this._ps; |
| 1270 | } |
| 1271 | // possible future addition - if an animation is removed from its parent and then .restart() or .play() or .resume() is called, perhaps we should force it back into the globalTimeline but be careful because what if it's already at its end? We don't want it to just persist forever and not get released for GC. |
| 1272 | // !this.parent && !value && this._tTime < this._tDur && this !== _globalTimeline && _globalTimeline.add(this); |
| 1273 | if (this._ps !== value) { |
| 1274 | this._ps = value; |
| 1275 | if (value) { |
| 1276 | this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()); // if the pause occurs during the delay phase, make sure that's factored in when resuming. |
| 1277 | this._ts = this._act = 0; // _ts is the functional timeScale, so a paused tween would effectively have a timeScale of 0. We record the "real" timeScale as _rts (recorded time scale) |
| 1278 | } else { |
| 1279 | _wake(); |
| 1280 | this._ts = this._rts; |
| 1281 | //only defer to _pTime (pauseTime) if tTime is zero. Remember, someone could pause() an animation, then scrub the playhead and resume(). If the parent doesn't have smoothChildTiming, we render at the rawTime() because the startTime won't get updated. |
| 1282 | this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, (this.progress() === 1) && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum)); // edge case: animation.progress(1).pause().play() wouldn't render again because the playhead is already at the end, but the call to totalTime() below will add it back to its parent...and not remove it again (since removing only happens upon rendering at a new time). Offsetting the _tTime slightly is done simply to cause the final render in totalTime() that'll pop it off its timeline (if autoRemoveChildren is true, of course). Check to make sure _zTime isn't -_tinyNum to avoid an edge case where the playhead is pushed to the end but INSIDE a tween/callback, the timeline itself is paused thus halting rendering and leaving a few unrendered. When resuming, it wouldn't render those otherwise. |
| 1283 | } |
| 1284 | } |
| 1285 | return this; |
| 1286 | } |
| 1287 | |
| 1288 | startTime(value) { |
| 1289 | if (arguments.length) { |
no test coverage detected