Re: [csswg-drafts] [web-animations-1] Allow setting timeline in Element.animate() (#5013)

>     * At the moment spec passes options verbatim to KeyframeEffect but timeline is an animation concept so we have to separate these in spec before passing the options to keyframes. This is not a big deal IMHO.

I don't think there's any need to separate these out. We already have [`KeyframeAnimationOptions`](https://drafts.csswg.org/web-animations-1/#dictdef-keyframeanimationoptions) which augments `KeyframeEffectOptions` with the `id` member that only applies to animations (as opposed to keyframe effects). And we just pass the `options` parameter to `animate()` straight along to the `KeyframeEffect` constructor. I think it would be fine to do the same here.

> Add a third parameter just for timeline

Since we're already putting animation options in the `options` parameter, I think we should continue to do so.

You'll probably need to be careful, however, to match the semantics of the [`timeline`](https://drafts.csswg.org/web-animations-1/#dom-animation-animation-effect-timeline-timeline) parameter to the `Animation()` constructor, however where there is a distinction between passing `null` (explicitly setting the timeline to null) and not passing anything (uses the default document timeline). I can't remember what WebIDL does if you explicitly pass `undefined`, however, or whether you can produce that same behavior with a dictionary member.

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

Received on Monday, 27 April 2020 23:54:59 UTC