Skip to content

Update procedure for determining if at a progress timeline boundary#13819

Open
kevers-google wants to merge 10 commits intow3c:mainfrom
kevers-google:at-progress-boundary
Open

Update procedure for determining if at a progress timeline boundary#13819
kevers-google wants to merge 10 commits intow3c:mainfrom
kevers-google:at-progress-boundary

Conversation

@kevers-google
Copy link
Copy Markdown
Contributor

[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.

Comment thread web-animations-2/Overview.bs Outdated
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
Copy link
Copy Markdown
Contributor

@flackr flackr Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread web-animations-2/Overview.bs Outdated
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=]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This early return is likely irrelevant if minimum and maximum timeline time are defined and not reachable by regular timelines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread web-animations-2/Overview.bs Outdated
:: <code>(<var>timeline time</var> - [=animation/start time=])
&times; [=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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread web-animations-2/Overview.bs Outdated
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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the need for considering playstate.

Comment thread web-animations-2/Overview.bs Outdated
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you say "produces" do you mean the current time?

Shouldn't we only return true if the animation's range includes this time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread web-animations-2/Overview.bs Outdated
>
> <dfn>maximum timeline time</dfn>
>
> For a scroll-timeline, the minimum timeline time is the timeline time
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo s/minimum/maximum

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread web-animations-2/Overview.bs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/at progress timeline boundary/at timeline boundary

Comment thread web-animations-2/Overview.bs Outdated
[=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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants