Update procedure for determining if at a progress timeline boundary#13819
Update procedure for determining if at a progress timeline boundary#13819kevers-google wants to merge 10 commits intow3c:mainfrom
Conversation
| precisely at the scroll limit, alleviating the need for set a fill-mode with | ||
| a ScrollTimeline. Checking if timeline [=timeline/current time=] is | ||
| 0 or timeline duration may be sufficient. | ||
| 1. If the timeline produces the minimum or maximum possible timeline |
There was a problem hiding this comment.
I think we need to define these as linkable spec terms, and say that for view or scroll timelines they are the time value at min and max scroll offset, and can just be +/- infinity for time based timelines for now.
| 1. Let <var>effective timeline progress</var> be | ||
| <code><var>effective timeline time</var> / [=timeline duration=]</code> | ||
| 1. If the associated <a>animation</a>'s timeline is not a | ||
| [=progress-based timeline=] |
There was a problem hiding this comment.
This early return is likely irrelevant if minimum and maximum timeline time are defined and not reachable by regular timelines.
| :: <code>(<var>timeline time</var> - [=animation/start time=]) | ||
| × [=playback rate=]</code> | ||
| For a scroll-timeline, the minimum timeline time is the timeline time associated | ||
| with the minimum scroll offset. For a time-based timeline, it is -infinity. |
There was a problem hiding this comment.
Can you define these timeline values under section 2.2 alongside the duration that was added for timelines:
https://drafts.csswg.org/web-animations-2/#timelines
| introduce a lead or lag, between the <a>timeline</a>'s current time and | ||
| <a>animation</a>'s current time. | ||
| 1. If the playState is *not* paused, or | ||
| [=held at progress timeline boundary=] is unresolved: |
There was a problem hiding this comment.
I'm not sure about this having a live value with a paused animation when held at progress timeline boundary is unresolved - however that happens. Do you have an example of what actions cause this? Can we "resolve" the held value?
There was a problem hiding this comment.
Removed the need for considering playstate.
| precisely at the scroll limit, alleviating the need for set a fill-mode with | ||
| a ScrollTimeline. Checking if timeline [=timeline/current time=] is | ||
| 0 or timeline duration may be sufficient. | ||
| 1. If the timeline produces the [=minimum timeline time=] or |
There was a problem hiding this comment.
When you say "produces" do you mean the current time?
Shouldn't we only return true if the animation's range includes this time?
There was a problem hiding this comment.
The phase calculation asserts that the local time matches the before-active or active-after boundary. This procedure is simplified to simply indicate if the animation's currentTime is the minimum or maximum possible value given the timeline. So if you are at the before-active boundary and can't produce a lower value for currentTime based on the timeline then inclusive. Similarly if at the active-after boundary and can't produce a higher value based on the timeline, then inclusive.
There was a problem hiding this comment.
Ah right, I mixed up that this procedure is only meant to be about the timeline's state, and the place we call it has already checked the state of the animation.
| > | ||
| > <dfn>maximum timeline time</dfn> | ||
| > | ||
| > For a scroll-timeline, the minimum timeline time is the timeline time |
There was a problem hiding this comment.
s/at progress timeline boundary/at timeline boundary
| [=animation/start time=] if resolved, or zero otherwise. | ||
| <dl class="switch"> | ||
| : If the [=minimum timeline time=] matches the animation's | ||
| [=current time=], and playbackRate = -1: |
There was a problem hiding this comment.
I'm not sure I understand this, the animation's current time is a calculation based on the timeline time, https://www.w3.org/TR/web-animations-1/#the-current-time-of-an-animation . As such, couldn't the animation be at time 0 when the timeline time is not at time 0, matching this condition.
Should this be the timeline current time? https://www.w3.org/TR/web-animations-1/#timeline-current-time
I.e. I think it doesn't care about the animation you're asking about because we already only call this for an animation that is at its before/after-active boundary.
There was a problem hiding this comment.
Based on offline discussion, simplified to require matching timeline current time. This breaks paused animations but avoids complications regarding the effect of start time on running animations.
[web-animations-2][scroll-animations-1]
Update spec based on discussion in #12134.
Keeping the animation in effect at a phase boundary is intended to alleviate the need for a fill mode, when the scroll range for the animation aligns with the maximum or minimum scroll position. The update aligns with the original intent of the feature.