Re: [csswg-drafts] [css-shared-element-transitions-1] Define "active animation" used to signal end of transition (#7785)

> Thanks for the question @birtles. Can you give an example of a document timeline (other than the default document timeline) which is associated with the a document.

Sure, `new DocumentTimeline()`.

> I couldn't figure out how these would be created/used from the spec text regarding [timelines associated with a document](https://drafts.csswg.org/web-animations-1/#timeline-associated-with-a-document).

You can use it as follows:

```js
const timeline = new DocumentTimeline(performance.now());
const animation = new Animation(new KeyframeEffect(elem, { opacity: 0 }, 1000), timeline);
```

Alternatively you can take an existing animation and set its timeline using the `timeline` setter on `Animation`.

It's usage is probably almost non-existent but from a spec point of view I think it probably makes sense to include non-default document timelines [associated with](https://drafts.csswg.org/web-animations-1/#timeline-associated-with-a-document) the current document.

> I want to avoid including timelines which are not guaranteed to move forward at frame boundaries. They could rely on events which may not occur and that makes it unclear how the animation will finish. That's not the issue with the default document timeline based on the text [here](https://drafts.csswg.org/web-animations-1/#document-timelines:~:text=since%20the%20time%20values%20of%20the%20default%20document%20timeline%20have%20a%20zero%20offset%20from%20the%20time%20origin%2C%20document.timeline.currentTime%20will%20roughly%20correspond%20to%20Performance.now()%20%5BHR%2DTIME%5D) ...

Right. The same is true for non-default document timelines.

> But I'm not sure if the above is true for other document timelines or the generic monotonically increasing timelines. While its clear that these timelines will always move forward, I'm not sure what triggers their advancement.

It is for other document timelines. No other types of monotonically increasing timelines currently exist so it's hard to say if that guarantee will hold so perhaps it's safest to limit it to document timelines.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 7 October 2022 00:16:59 UTC