Re: [csswg-drafts] [web-animations-1] Make animations become idle when they have an inactive timeline (#2066)

Based on the animation state charts provided above, here is the essence of the proposal for handling inactive timelines:
- If animation.play() or animatio.pause() is called with inactive timeline, instead of initializing hold_time to zero, set start_time to zero. This produces unresolved animation current time and, as a result, animation effect is not applied.
- Execute animation pending pause task when inactive timeline becomes active. This makes ready time resolved at the time of the execution and, as a result, produces resolved hold_time.
- Currently setting current time of running animation when the timeline is inactive makes the animation transition to paused state. To keep the animation running, the proposal is to queue a play pending task which is executed as soon as the timeline becomes active.
```javascript
animation = new Animation(new KeyframeEffect(...}],
                                             { duration: 2000}), document.timeline);
animation.play();
await animation.ready;
animation.timeline = null;
console.log(animation.currentTime); //null 
animation.currentTime = 500;
console.log(animation.playState);  // running because the animation has play pending task
animation.timeline = document.timeline;
await animation.ready;
console.log(animation.playState);  //running
```


-- 
GitHub Notification of comment by ogerchikov
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2066#issuecomment-594835646 using your GitHub account

Received on Wednesday, 4 March 2020 20:57:52 UTC