-
Notifications
You must be signed in to change notification settings - Fork 715
[web-animations-1] Allow setting timeline in Element.animate() #5013
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
I don't think there's any need to separate these out. We already have
Since we're already putting animation options in the You'll probably need to be careful, however, to match the semantics of the |
Thanks for the feedback. Let's add As for matching the semantic of timeline param in For example I think the following IDL and text should give the desired behavior with the exact text as Animation constructor: dictionary KeyframeAnimationOptions : KeyframeEffectOptions {
DOMString id = "";
AnimationTimeline? timeline;
}; Animation constructor text:
Unspecified value case: Per Webidl an unspecified optional dictionary member is considered missing (Note that dictionary members are optional unless they are explicitly marked as required). So for: div.animate({/* keyframes*/ }, { duration: 1000}); We should receive a missing timeline value which we trun into Explicit null case: Since type is nullable passing null is valid and we will get null value which div.animate({/* keyframes*/ }, { duration: 1000, timeline: null}); |
Right, I was mostly just curious what happens when you explicitly specify I believe WebIDL makes that the same as |
I got confused by the spec section that you linked because it contradicts with this note in WebIDL spec regarding the dictionary.
But I think I now have figured out the source of the confusion. The conversion process for turning an ECMAScript Object values into an IDL dictionary Here is the key part of the algorithm that converts a member of the object into a member of the dictionary:
If I am reading this correctly an explicitly (or implicitly) undefined This is consistent with the note in the spec too. So I think with our current definition, we get no data members which we handles |
So |
No I think they behave the same. Correct me if I am wrong but here is the current
My quick test shows the same in both Firefox and Chrome. Here is the proposed IDL and spec text which I also have #5033:
and the proposed spec text:
In this IDL the timeline is an optional value with no default. So per earlier discussion of the conversion algorithm, passing Passing So I believe we have the same behavior as |
The options dictionary in `Element.animate` now has an optional nullable timeline member. This allows timeline to be set via that method in addition to Animation constructor. The semantic of handling explicit null and implicit/explicit undefined timelines are the same between the two methods. Here are some examples of how this may be used: ``` // Create animation with a null timeline. div.animate({color: 'red' }, { duration: 1000, timeline: null}); ``` ``` // Create a scroll-linked animation. div.animate({color: 'red' }, { duration: 1000, timeline: new ScrollTimeline()}); ```
This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720
This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720
This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720
This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720
This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220352 Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: Majid Valipour <majidvp@chromium.org> Cr-Commit-Position: refs/heads/master@{#773733}
This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220352 Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: Majid Valipour <majidvp@chromium.org> Cr-Commit-Position: refs/heads/master@{#773733}
This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220352 Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: Majid Valipour <majidvp@chromium.org> Cr-Commit-Position: refs/heads/master@{#773733}
….animate(), a=testonly Automatic update from web-platform-tests [ScrollTimeline] Add timeline to Element.animate() This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220352 Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: Majid Valipour <majidvp@chromium.org> Cr-Commit-Position: refs/heads/master@{#773733} -- wpt-commits: a0740be4f6a5f18e016abd3dcadef53177dde234 wpt-pr: 23847
….animate(), a=testonly Automatic update from web-platform-tests [ScrollTimeline] Add timeline to Element.animate() This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220352 Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: Majid Valipour <majidvp@chromium.org> Cr-Commit-Position: refs/heads/master@{#773733} -- wpt-commits: a0740be4f6a5f18e016abd3dcadef53177dde234 wpt-pr: 23847
….animate(), a=testonly Automatic update from web-platform-tests [ScrollTimeline] Add timeline to Element.animate() This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220352 Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: Majid Valipour <majidvp@chromium.org> Cr-Commit-Position: refs/heads/master@{#773733} -- wpt-commits: a0740be4f6a5f18e016abd3dcadef53177dde234 wpt-pr: 23847 Differential Revision: https://phabricator.services.mozilla.com/D78334
….animate(), a=testonly Automatic update from web-platform-tests [ScrollTimeline] Add timeline to Element.animate() This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220352 Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: Majid Valipour <majidvp@chromium.org> Cr-Commit-Position: refs/heads/master@{#773733} -- wpt-commits: a0740be4f6a5f18e016abd3dcadef53177dde234 wpt-pr: 23847 Differential Revision: https://phabricator.services.mozilla.com/D78334
….animate(), a=testonly Automatic update from web-platform-tests [ScrollTimeline] Add timeline to Element.animate() This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220352 Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: Majid Valipour <majidvp@chromium.org> Cr-Commit-Position: refs/heads/master@{#773733} -- wpt-commits: a0740be4f6a5f18e016abd3dcadef53177dde234 wpt-pr: 23847
….animate(), a=testonly Automatic update from web-platform-tests [ScrollTimeline] Add timeline to Element.animate() This patch adds a timeline option to Element.animate() function based on the recent spec change: w3c/csswg-drafts#5013. Change-Id: Ibf7e6f824f9e013f62da015cebdbc893255142dd Bug: 1080720 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220352 Commit-Queue: Yi Gu <yigu@chromium.org> Reviewed-by: Majid Valipour <majidvp@chromium.org> Cr-Commit-Position: refs/heads/master@{#773733} -- wpt-commits: a0740be4f6a5f18e016abd3dcadef53177dde234 wpt-pr: 23847 Differential Revision: https://phabricator.services.mozilla.com/D78334
Proposal
Web Animations allows creation of
AnimationTimeline
but it does not support using a custom timeline inelement.animate()
method. The only option is to use Animation constructor directly.I believe as we get closer to having
ScrollTimeline
the ability to continue to use the familiar and simple to useElement.animate()
for scroll linked animations is important. This issue is here to consider introducing a way to to pass in a timeline as part ofElement.animate(keyframes, options)
.Syntax Options
If it is decided that we want this, here are some ideas on syntax:
Extend options to have a timeline member
This is an example of how it may work:
Pros:
Cons:
FWIW, this is the method that @flackr has chosen in their scroll-timeline polyfill.
Add a third parameter just for timeline
This is an example of how it may work:
I find this a bit less ergonomic that the previous one. It may be more appealing if there were other animation specific options.
The text was updated successfully, but these errors were encountered: