-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-animations-2] Specify the interaction between API methods and animation-* properties #4822
Comments
Basing stickiness on whether a web-animation API call changes the play state makes sense. This change would also address reverse from a paused state, or playbackRate in an onfinish handler. |
Currently what I have in mind (and what I am implementing in Firefox) is that for That is, setting the What do you think? |
…pler "once overridden always overridden" approach This corresponds to the approach outlined in w3c/csswg-drafts#4822 Specifically: * Calling play() / pause() always triggers the "animation play state is being overridden by the API" behavior (unless the method throws an exception). * Setting the startTime or calling reverse() only triggers this override behavior if it results in a change between a playState that is paused and a playState that is not paused. Differential Revision: https://phabricator.services.mozilla.com/D65100 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1459536 gecko-commit: 02295b7142ac27bced7328970a4e1f676bf40cf4 gecko-integration-branch: autoland gecko-reviewers: boris
Thinking about this a little further, I think I would be ok with |
…ate with a simpler "once overridden always overridden" approach; r=boris This corresponds to the approach outlined in w3c/csswg-drafts#4822 Specifically: * Calling play() / pause() always triggers the "animation play state is being overridden by the API" behavior (unless the method throws an exception). * Setting the startTime or calling reverse() only triggers this override behavior if it results in a change between a playState that is paused and a playState that is not paused. Differential Revision: https://phabricator.services.mozilla.com/D65100
…ate with a simpler "once overridden always overridden" approach; r=boris This corresponds to the approach outlined in w3c/csswg-drafts#4822 Specifically: * Calling play() / pause() always triggers the "animation play state is being overridden by the API" behavior (unless the method throws an exception). * Setting the startTime or calling reverse() only triggers this override behavior if it results in a change between a playState that is paused and a playState that is not paused. Differential Revision: https://phabricator.services.mozilla.com/D65100 --HG-- extra : moz-landing-system : lando
Just to be clear, does this example (from your original post) still pause, but just not set the sticky override? div.style.animation = 'anim 10s';
const animation = div.getAnimations()[0];
await animation.ready;
// Pause using the start time
animation.startTime = null; |
To expediate the discussion: If the above pauses, the Then does flipping it cause the animation to start running? div.style.animationPlayState = 'paused';
animation.playState; // still paused, style flushed
div.style.animationPlayState = 'running';
// is it now running? If the above doesn't pause, then setting the start time has no effect? |
…22077) * Extract common keyframe comparison test methods We will use this in the next patch to test the result after calling setKeyframes. Differential Revision: https://phabricator.services.mozilla.com/D65096 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1459536 gecko-commit: c206b97b74471740983bec1da249c70a0e840dd5 gecko-integration-branch: autoland gecko-reviewers: boris * Ignore subsequent changes to @Keyframes after calling setKeyframes Differential Revision: https://phabricator.services.mozilla.com/D65097 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1459536 gecko-commit: 7c8d563e57ea6ea8b39efe857fcb5599a0ed5f67 gecko-integration-branch: autoland gecko-reviewers: boris * Allow CSS animation timing properties to be overridden using the Web Animations API Differential Revision: https://phabricator.services.mozilla.com/D65098 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1459536 gecko-commit: d6f2c615730f6ccbe93e82e398bb3f17cd69e7f6 gecko-integration-branch: autoland gecko-reviewers: boris * Allow CSS animation properties to be overridden by replacing the effect Differential Revision: https://phabricator.services.mozilla.com/D65099 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1459536 gecko-commit: 4c24b62d2686a6b359f275f53407592f39dd2242 gecko-integration-branch: autoland gecko-reviewers: boris * Replace CSSAnimation interaction with animation-play-state with a simpler "once overridden always overridden" approach This corresponds to the approach outlined in w3c/csswg-drafts#4822 Specifically: * Calling play() / pause() always triggers the "animation play state is being overridden by the API" behavior (unless the method throws an exception). * Setting the startTime or calling reverse() only triggers this override behavior if it results in a change between a playState that is paused and a playState that is not paused. Differential Revision: https://phabricator.services.mozilla.com/D65100 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1459536 gecko-commit: 02295b7142ac27bced7328970a4e1f676bf40cf4 gecko-integration-branch: autoland gecko-reviewers: boris Co-authored-by: Brian Birtles <birtles@gmail.com>
Yes, that's right. This is purely about the override behavior.
Right, the proposal is that we use the same "stickiness" for timing properties that map to CSS animation-* properties. That is, once you override them from the API, we ignore the value set via style, even if it changes. Until I write up the spec text for this (hopefully today), it might be easiest to follow by looking at the patches / tests I just landed for this in Mozilla bug 1459536.
Flipping it does not cause the animation to start running. Once overridden, always overridden. |
I think there may have been a confusion - i meant to refer to this comment ^. I think that it probably should be sticky as it seems less confusing than having the properties not work as expected. |
Ok, let me check I understand. The original proposal is:
The point I was wondering about was whether we drop point 4 altogether or simply the condition from point 4. |
As I understand, your comment that "it should probably be sticky", would mean we should not drop point 4 altogether. Either we should keep it, or we should modify it so that it is unconditional. I'm a little averse to making it unconditional since I can imagine people wanting to (And I forgot to include in the original proposal that replacing |
Correct, that is what I was suggesting.
Agreed. It's a little magical, but I think trying to avoid it has stranger ramifications.
I think this is reasonable. |
…mations API Fixes w3c#4822.
I started working on this today over at: birtles@83dd532 I didn't quite finish it but hopefully the outline is mostly there. Please take a look when you get a chance. I hope to finish it off tomorrow. |
…ate with a simpler "once overridden always overridden" approach; r=boris This corresponds to the approach outlined in w3c/csswg-drafts#4822 Specifically: * Calling play() / pause() always triggers the "animation play state is being overridden by the API" behavior (unless the method throws an exception). * Setting the startTime or calling reverse() only triggers this override behavior if it results in a change between a playState that is paused and a playState that is not paused. Differential Revision: https://phabricator.services.mozilla.com/D65100 UltraBlame original commit: 02295b7142ac27bced7328970a4e1f676bf40cf4
…ate with a simpler "once overridden always overridden" approach; r=boris This corresponds to the approach outlined in w3c/csswg-drafts#4822 Specifically: * Calling play() / pause() always triggers the "animation play state is being overridden by the API" behavior (unless the method throws an exception). * Setting the startTime or calling reverse() only triggers this override behavior if it results in a change between a playState that is paused and a playState that is not paused. Differential Revision: https://phabricator.services.mozilla.com/D65100 UltraBlame original commit: 02295b7142ac27bced7328970a4e1f676bf40cf4
…ate with a simpler "once overridden always overridden" approach; r=boris This corresponds to the approach outlined in w3c/csswg-drafts#4822 Specifically: * Calling play() / pause() always triggers the "animation play state is being overridden by the API" behavior (unless the method throws an exception). * Setting the startTime or calling reverse() only triggers this override behavior if it results in a change between a playState that is paused and a playState that is not paused. Differential Revision: https://phabricator.services.mozilla.com/D65100 UltraBlame original commit: 02295b7142ac27bced7328970a4e1f676bf40cf4
…mations API Fixes w3c#4822.
I went ahead and merged my work on this. It's not perfect but it's better than nothing and I've spent quite a while on it by now. (I was really hoping someone else would step in to do this.) Hopefully we can tweak it from here. |
What is the expected override behavior in the following case: div.style.animation = 'anim 100s'; Should reverse override animationPlayState since going from a pending pause state to pending play? In other words, should reverse and startTime be flushing any pending changes to play state? Admittedly a very contrived case. |
I think they probably should. The spec wording...
is not 100% clear, but the intention is that all these methods operate on a fully-updated state. It's somewhat unfortunate to have to make all these methods flush, but I think that's the most understandable behavior. Also, it's quite possible Firefox doesn't flush for |
…mations. w3c/csswg-drafts#4822 Bug: 1059772 Change-Id: Id21c3c152f8cf6771703a16fcab8e80686608170 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090197 Commit-Queue: Kevin Ellis <kevers@chromium.org> Reviewed-by: Robert Flack <flackr@chromium.org> Cr-Commit-Position: refs/heads/master@{#749013}
This is something we've discussed a number of times and the general consensus is that once you tweak a property from the API, any changes to the corresponding markup (
animation-*
property or@keyframes
rule) is ignored.Furthermore, the proposal is that this should apply to animation play state too (rather than the very convoluted behavior that is currently specced where pause is sticky but play is not).
Once interesting edge case with regards to play state is setting the
startTime
of an animation since that is equivalent to pausing or playing in some cases.e.g. (1) - no change to play state
e.g. (2) - play state is changed
That's my intuition anyway. What do others think?
I'm looking to spec this in the next few days so any feedback would be much appreciated.
/cc @graouts @stephenmcgruer @flackr @kevers-google
The text was updated successfully, but these errors were encountered: