Re: [csswg-drafts] [web-animations-2] Allow Animation constructor to take an object of properties as second param (#11146)

The CSS Working Group just discussed `[web-animations-2] Allow Animation constructor to take an object of properties as second param`, and agreed to the following:

* `RESOLVED: Add an overload to the animation constructor that takes a dictionary of animation-specific options as a second argument, like the second element.animate() argument`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> bramus: proposal is add an object param to Animation ctro<br>
&lt;emilio> ... current behavior is effect then timeline<br>
&lt;emilio> ... with scroll-animations you also have ranges etc<br>
&lt;astearns> s/ctro/constructor/<br>
&lt;emilio> ... the answer is to also attach a KeyframeAnimationOptions<br>
&lt;flackr> q+<br>
&lt;emilio> ... then authors can easily transition from `.animate()` to `new Animation()`<br>
&lt;emilio> q+<br>
&lt;emilio> flackr: I think some of the options are things that are specified by the first parameter<br>
&lt;emilio> ... in the spec an animation effect has iterationDuration, playback direction, fill mode<br>
&lt;emilio> ... so maybe we need to split off just the animation-specific props into its own dictionary<br>
&lt;emilio> bramus: would make sense<br>
&lt;emilio> ack flackr<br>
&lt;astearns> ack emilio<br>
&lt;bramus> emilio: was gonna suggest just that<br>
&lt;bramus> … and can we add 1-arg version that fixes element.animate?<br>
&lt;ydaniv> q+<br>
&lt;bramus> … than just set the target<br>
&lt;bramus> … i forget how the object model works for this<br>
&lt;bramus> flackr: dont see why we could not do that<br>
&lt;emilio> ydaniv: element.animate() already takes a second arg with the options<br>
&lt;bramus> emilio: i meant to make the animation constructore more parallel to .animate<br>
&lt;bramus> flackr: like  two-arg version<br>
&lt;bramus> ydaniv: its the original proposal<br>
&lt;bramus> emilio: no, because you have like an effect<br>
&lt;bramus> flackr: its contstructing an effect<br>
&lt;bramus> ydaniv: so you mean the first arg<br>
&lt;bramus> emilio: yes, it would be differnt than just .animate<br>
&lt;emilio> s/than just/, just like<br>
&lt;bramus> flackr: and might need to add target<br>
&lt;bramus> emilio: right<br>
&lt;bramus> ydaniv: so we split ???<br>
&lt;bramus> emilio: yeah, its fine<br>
&lt;emilio> ydaniv: maybe that should be a separate issue?<br>
&lt;bramus> astearns: so what remains is?<br>
&lt;emilio> astearns: so what remains?<br>
&lt;emilio> PROPOSED: Add an overload to the animation constructor that takes animation-specific options as a second argument, like the second element.animate() argument<br>
&lt;emilio> RESOLVED: Add an overload to the animation constructor that takes a dictionary of animation-specific options as a second argument, like the second element.animate() argument<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11146#issuecomment-2628591259 using your GitHub account


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

Received on Saturday, 1 February 2025 00:01:23 UTC