-
Notifications
You must be signed in to change notification settings - Fork 708
[css-animations-2][web-animations-2] How should animation-play-state
interact with animation-trigger
?
#12064
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
Comments
Thanks for filing this!
I think I agree with the proposal overall with one (perhaps significant) difference: I wouldn't say that a trigger's effects are overridden by I think where this really makes a difference is when we consider what happens when we have a scroll-based trigger (no time-based triggers for now) and the exit condition is met. With A related question I was thinking about was: when an animation with a |
I haven't thought about the detail here but broadly speaking the layering makes sense to me. At very least, WAAPI needs to be able to override the trigger mechanism so that DevTools etc. can inspect triggered animations. |
Yes, that's gist of it. I guess "overridden" is less accurate here.
Yes, agreed. With
Here I think is where the |
Do you mean overriding |
Yes, the latter. |
@birtles so the question is what do you mean by "override"? |
@ydaniv That sounds fine but it makes me wonder, does That is, can a user still do |
Sure, any method should apply its effect, so calling |
But haven't we defined that if a trigger is attached to an animation then it ends up being put in the before phase with a zero time? Meaning that if it has a backwards fill, that will take effect? So in order to remove that does |
Currently, any animation has an initial value of |
This seems related to the issue @ydaniv linked earlier. There, our current proposal is that
If we don't want the trigger to be able to perform those actions on the animation after
|
@ydaniv Maybe the problem is I don't understand how the following behavior is intended to be realised:
What part of the timing model is actually updated here?
Depending on how an idle trigger interacts with the timing model, |
@DavMila Not really, I'm just trying to understand if |
Perhaps this part does need a more precise definition. Maybe it would have made more sense to set Then upon
Ooh, yes, we need to change that as well. @birtles does the above suggestions work better for you? |
Maybe it makes more sense to have the
.. better worded perhaps and also doing something similar for a "backwards" direction animation and the
If we do what I mentioned just above, we would be introducing a state where you could be in the |
Ah, I see a problem with my proposal: Perhaps we can:
(Similar update for "in the after phase") This way, |
Why can't a monotonic timeline be a trigger? I mean I know we don't have the ability to specify meaningful ranges today but it seems like this doesn't need a special case, all monotonic timeline triggers specifiable today will be in a permanently triggered state AFAICT.
I think we need to stop the trigger if cancel is called, does your proposal do this? I'm not sure how you would re-arm the trigger, unless we decide that play on an animation with a trigger does not actually mean to play it but just to arm the trigger - which I think might provide a nice overall consistency to the way everything works. |
Removing that check should be fine. We probably just need to check that its trigger isn't
No, I'm not proposing we disable the trigger when cancel is called. I can see how that would make sense to a developer but are you suggesting that as a way of addressing the current issue we are discussing (preserving the effect/behavior of cancel) or are you suggesting that separately/generally (this would be related to #11914)? I don't think we need to disable the trigger to preserve the behavior of cancel. |
The reason we are applying the before fill phase is because we have an animation that can trigger and animate from the 0% keyframe and the animation wants it to animate from the value it has at 0% rather than jumping to that value when the animation is triggered. As a developer I think the intent expressed by canceling the animation is not just to temporarily remove the If we make it so that "playing" an animation means to arm the trigger, this nicely explains how an animation constructed by element.animate or css animations with a trigger would not begin advancing immediately - they enter their before (or after depending on playback direction) phase until the trigger condition is met. Note that this is not a specific way of addressing this particular issue but a broad framework for thinking about how to make sense of the impact of animation triggers on all of the interactions with other animation properties. I'm open to considering whether play should just be treated as an immediate trigger condition rather than arming the trigger, exploring some common use cases for using these apis would be helpful. |
Just a quick comment to say I really like the broad thinking here. Thank you for all those suggestions. It would be nice, if possible, to avoid complicating the timing model algorithms with trigger-specific flags and conditions. (If they do prove necessary, however, I hope we can abstract some general flag(s)—like the |
I agree with @flackr on the behavior: calling If If the developer wishes to remove the trigger they can always do so explicitly. What still remains open is deciding how exactly this mechanism works. If I'm not mistaken, we didn't change anything in |
I have another direction at this:
I think this solves the |
Since this issue was originally on interaction of Proposal
|
Before the addition of
animation-trigger
it was possible to control the playback state of an animation using theanimation-play-state
property or using the Web Animations API via the.play()
/.pause()
/.reverse()
methods or setting the animation'splaybackRate
.A Trigger applies an effect on its associated animation based on its type and state, and these effects are currently defined by the playing, pausing, and reversing an animation procedures. That is now yet another method to control playback state.
To resolve conflicts between properties specified in CSS and state changes by usage of the WAAPI, it is specified how the latter takes precedence over changes to corresponding properties in CSS.
But now we have a new CSS property,
animation-trigger
, that may conflict with another property,animation-play-state
, and it may not be trivial to determine how these two properties interact with each other and what should be the playback state when their both specified to non default values.With the default values for
animation-trigger
beingonce auto
we may already have an existing definition of this interaction:animation-play-state
is set torunning
then the trigger behaves normally as specified.animation-play-state
is set topaused
then the trigger's behavior is overridden and the animation's playback remains paused.play-state
set topaused
still triggers theanimationstart
event. However, we may say that animations with a trigger with a view timeilne must only trigger animation events according to their progress inside their attachment range. So for example, animation withanimation-trigger: view() repeat
will only trigger itsanimationstart
event once it enters its0-100%
range.Additionally, changes to playback state via WAAPI continue overriding
animation-play-state
as specified, but don't override changes toanimation-trigger
.Proposal
animation-trigger
does not override the behavior ofanimation-play-state
.animation-play-state
is set torunning
then the associated trigger's effects continue as specified.animation-play-state
is set topaused
then the associated trigger's effects are overridden and the animation remains paused.paused
but only when entering/exiting the trigger's attachment range./cc @flackr @DavMila @birtles
The text was updated successfully, but these errors were encountered: