W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2020

[csswg-drafts] [web-animations] Could commitStyles always write the end state of the animation? (#5394)

From: Zartaj Majeed via GitHub <sysbot+gh@w3.org>
Date: Tue, 04 Aug 2020 22:37:13 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-673127165-1596580632-sysbot+gh@w3.org>
zmajeed has just created a new issue for https://github.com/w3c/csswg-drafts:

== [web-animations] Could commitStyles always write the end state of the animation? ==
MDN https://developer.mozilla.org/en-US/docs/Web/API/Animation/commitStyles says:

"The commitStyles() method of the Web Animations API's Animation interface commits the end styling state of an animation to the element being animated, even after that animation has been removed. It will cause the end styling state to be written to the element being animated, in the form of properties inside a style attribute."

This is exactly what I want and I like the example in which `commitStyles()` is called right after the animation is created. The expected behavior is very clear since the end state of an animation is well-defined

To my surprise in Chrome 84 this is not the case. Looking at the spec it seems MDN got it wrong:

https://drafts.csswg.org/web-animations/#dom-animation-commitstyles says:

"Writes the current effect values produced by this animation’s animation effects to their corresponding effect targets' inline style using the commit computed styles procedure."

So an animation of `transform: translate(100px), duration: 1000` may record a translation of anywhere between 0 and 100px depending on when `commitStyles()` is called. Sure calling it after the animation finishes insures the end state is written but seems to also require setting `fill: fowards`. It just seems much easier and more intuitive to have it record a predictable state no matter when it's called

Could `commitStyles()` have an option to always record the end state preferably without involving the `fill` property. Even better could it become an animation property and I wouldn't have to use `fill` at all.




Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5394 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 4 August 2020 22:37:16 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:13 UTC