Skip to content
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

[web-animations-2] [scroll-animations-1] Support automatic duration scroll animations #6337

Merged
merged 5 commits into from
Jun 24, 2021

Conversation

kevers-google
Copy link
Contributor

Change the implicit handling of auto duration animations to use the duration of the supplied timeline if resolved. Scroll-timelines have an implicit timeline duration and the intrinsic iteration duration can be calculated based on this value. Document timelines will have an unresolved timeline duration, which will translate to an intrinsic iteration duration of zero consistent with the currently specified behavior.

If the timeline duration is resolved, effect timing is normalized based on this duration.

This pull request is a replacement for #4890.

@kevers-google kevers-google changed the title Scroll timeline progress based [web-animations-1] [scroll-animations-1] Support automatic duration scroll animations Jun 2, 2021
@kevers-google kevers-google changed the title [web-animations-1] [scroll-animations-1] Support automatic duration scroll animations [web-animations-2] [scroll-animations-1] Support automatic duration scroll animations Jun 2, 2021
Copy link
Contributor

@flackr flackr left a comment

Choose a reason for hiding this comment

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

This PR seems to be including a bunch of unrelated commits, I wonder if you've done an invalid rebase or similar. I think you should be able to rebase your branch onto the remote branch and force push to clean this up.

From @birtles comments on https://github.com/w3c/csswg-drafts/pull/4890/files I think this may still need to rework the intrinsic iteration duration of group effects.

@@ -910,7 +865,7 @@ The [=current time=] of a {{ScrollTimeline}} is calculated as follows:

: If |current scroll offset| is greater than or equal to [=effective
end offset=]:
:: The [=current time=] is the [=effective time range=].
:: The [=current time=] is the [=duration=].

: Otherwise,
:: 1. Let |progress| be a result of applying
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like there are still references to effective time range (e.g. on line 876 below). Github won't let me comment on ellided lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Can find no remaining references to "time range"

@kevers-google kevers-google force-pushed the scroll-timeline-progress-based branch from d0eaffc to b523b28 Compare June 9, 2021 16:41
@kevers-google
Copy link
Contributor Author

Rebase should be cleaned up now.

Copy link
Contributor

@birtles birtles left a comment

Choose a reason for hiding this comment

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

Looks good to me. I probably should give it another check before merging however.

scroll-animations-1/Overview.bs Show resolved Hide resolved
web-animations-2/Overview.bs Outdated Show resolved Hide resolved
web-animations-2/Overview.bs Outdated Show resolved Hide resolved
Comment on lines 181 to 182
> 1. Compute [=start delay=] to be the result of evaluating
> <code>|start delay| / |total time| * |timeline duration|</code>.
Copy link
Contributor

Choose a reason for hiding this comment

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

From a spec point of view, I suppose we need different terms to differentiate between the input "start delay" and the calculated "start delay"? Likewise for "iteration duration" and "end delay".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added definitions for specified duration and delays, as well as a normalization procedure, while simply copies over the specified values if time based and calls the normalization process if progress based.

Comment on lines 177 to 179
> 1. Let <var>total time</var> be equal to the result of evaluating
> <code>|start delay| + |iteration count| * |iteration duration| +
> |end delay|</code>.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should re-use the definition of end time here since it covers a few edge cases like infinite duration with zero iteration count and clamps the result to the positive range.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

> :: Return 0
>
> : Otherwise
> :: Return [=timeline duration=] / <a>iteration count</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to define the result when iteration count is zero.

Also, I think we do want to make this become something like (100% - start - end) / iteration_count as you mentioned in #4890 (comment) in this level of the spec, just not necessarily in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. With note that start and end are presently zero until such time as percentage delays are supported. Plans for a followup CL on CSSNumberish delays.

Comment on lines 2132 to 2135
> If the <a lt="timeline duration">duration</dfn> of the Animation's
> <a>timeline</a> is a percentage, the end delay will be treated as the
> result of applying the procedure to convert a
> [=time-based animation to a proportional animation=].
Copy link
Contributor

Choose a reason for hiding this comment

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

As well as updating the prose, I guess we need to update the type of the delay and endDelay attributes in EffectTiming and OptionalEffectTiming?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prefer to defer to a followup PR. The getTiming method returns specified timing, which for now will be time based (or potentially 'auto' for duration). Once we support CSSNumberish delays, then these interfaces will need to be updated. At present the start and end delay are not part of CalculatedTiming. Perhaps they should be since they could differ from the specified values after normalization. Again, prefer to defer.

web-animations-2/Overview.bs Outdated Show resolved Hide resolved
Copy link
Contributor

@birtles birtles left a comment

Choose a reason for hiding this comment

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

This looks good to me, although there are couple of minor nits you may like to address.

web-animations-2/Overview.bs Outdated Show resolved Hide resolved
web-animations-2/Overview.bs Outdated Show resolved Hide resolved
@birtles birtles merged commit 55e5aa8 into w3c:main Jun 24, 2021
@birtles
Copy link
Contributor

birtles commented Jun 24, 2021

Thank you!

@bramus
Copy link
Contributor

bramus commented Jun 25, 2021

In https://drafts.csswg.org/scroll-animations-1/#the-css-scroll-timeline-rule-interface I still see references to time-range.

Screenshot 2021-06-25 at 10 09 50

If I interpret this PR correctly time-range got removed so this part right here should be omitted too?

@kevers-google
Copy link
Contributor Author

Good catch bramus. Will have another PR up shortly.

@kevers-google
Copy link
Contributor Author

The 'start' and 'end' descriptors are out of date as well since replaced by scrollOffsets. Can clean this up with the remaining time-range reference.

@kevers-google
Copy link
Contributor Author

#6410

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.

None yet

4 participants