-
Notifications
You must be signed in to change notification settings - Fork 756
[web-animation-2] Resolution of fill=auto for progress-based timelines #6673
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect we might want this to be as narrow as possible. E.g. if the animation active active phase does not touch the end of the timeline it probably shouldn't fill. How about we add something like "and the start delay + active duration = 100%"?
Also, does this need to be fill: both? The start time is inclusive so we only need to extend the end to make it end-inclusive. The complication is of course that we have to flip the fill when the animation direction is "backwards" but this seems not too complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@birtles FYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the first condition is in agreement with the updated definition for 'auto' here: https://drafts.csswg.org/web-animations-2/#the-fillmode-enumeration but perhaps we could phrase it to be more generic such that each type of animation effect defines what "auto" means to it? e.g. introduce a term for that? intrinsic fill mode, default fill mode or something?
For the second condition I'm not sure. In general I prefer a wider definition because it feels less magical and more composable if there are fewer rules to consider. Furthermore, "fill: both" would mean we don't need to worry about the reversing case. However, I don't have a good sense for the implications of extending the fill mode to scroll-linked content. Is there any example content (real or artificial) that highlights the difference?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it would be nice to have a simple definition here. It could be something like if the animation effect is associated with a progress-based timeline and the specified effect duration is 'auto', then the intrinsic fill mode is 'both'. This would handle simple cases like:
The reason not to always use fill-mode: both is that it would be surprising in cases where the developer specifies an animation that does not fill the scroll range:
when the developer specifies a duration and end delay, e.g.
element.animate({transform: ['translateY(-50px)', 'none']}, {duration: 1000, endDelay: 1000, timeline: scrollTimeline}), we follow the procedure to convert to progress and have a computed duration of 50%. The developer would expect the animation not to be in effect during the end delay period.when we allow specifying percentage durations (e.g. as CSSNumericValues or percentage strings), the developer may specify one or more animations which are meant to follow each other, e.g.
when multiple effects are used with a SequenceEffect on a ScrollTimeline, the effects should split the duration of the timeline duration and we'd only expect the last effect to
fill: forwardsto include the end position.Of course the developer can always override the fill mode in some of those scenarios, I'd just like to get it right in most cases if we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Planning to put this PR on the back burner pending resolution of #6508. If the problem is limited to precisely the timeline boundaries, then perhaps best to resolve there. The fill resolution will get cumbersome if it needs to take into account start and end delays and also offsets that are not aligned at 0 and 100%.