-
Notifications
You must be signed in to change notification settings - Fork 711
[web-animations-2] Web animations API for specifying timeline phases in animation options. #7589
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
Leaning towards option 1 as it seems easier for the web developer (less verbose than option 2 and avoids potential confusion due to over-specification with option 3). |
Also leaning towards 1, as authors expect the css animations and web animations APIs to reflect each other as much as possible. |
Option 1 certainly seems the most straightforward, though option 2 is more consistent with the direction we've been trying to move in terms of having full rich types for the things that are expressed as strings in CSS. Regardless of option (1) or (2), we will still have similar over-specification issues if we also allow specifying non-"auto" durations e.g. #4342. I think we'll just have to choose a precedent - probably try to align this with what happens when you specify left, right and width on an element size. |
Another variant of 2 would be a new unit type to represent the phase + percentage pair, e.g. |
The one downside to starting with option 1 is that if this is the string value is what you read back from getTiming then we can't upgrade to option 2 without risking breaking content. |
Yeah, I mean we could introduce parallel properties -- typed and untyped/string-type -- and precedence rules for when they're both set, but then we'd break code that attempts to roundtrip the values, by fetching the timing, setting only the lower precedence one (e.g. the untyped/string-type one), then re-setting it. |
The CSS Working Group just discussed
The full IRC log of that discussion<TabAtkins> Topic: specifying timeline phases in WAAPI<TabAtkins> github: https://github.com//issues/7589 <TabAtkins> flackr: We've resolved on a CSS syntax for timeline phases, where you can tie an animation to a phase <TabAtkins> flackr: But we didn't talk about how this would work in waapi <TabAtkins> flackr: So, how do you make a WEb Animation that animates in a particular timeline phase? <TabAtkins> flackr: Main two proposals are (1) extend .delay and .endDelay properties, which map to equivalent css properties <TabAtkins> flackr: These accept doubles currenty, would need to bea ble to take something expressing a phase+proportion <TabAtkins> flackr: Advantage of option 1 is it's easy to udnerstand <TabAtkins> flackr: Option 2 is more in line with the desire to use typed properties in these JS bindings <TabAtkins> flackr: so we don't ahve to parse strings all the time <TabAtkins> flackr: I think Brian is on board with either <Rossen_> q? <TabAtkins> flackr: I have a slight preference for option 2, as it's more future-proof. Requires some wrapper around the fields, and there's a naming question <TabAtkins> TabAtkins: I'm fine with option 2, with details tbd by editors <TabAtkins> Rossen_: reading thru comments, Brian seems to supportive as well <TabAtkins> flackr: yeah, he doesn't seem worried about the string complexity, but had no objections to option 2 <TabAtkins> Rossen_: so current proposal is option 2 <TabAtkins> Rossen_: Not hearing much other opinions <TabAtkins> Rossen_: so suggest resolving on the direction <bramus> SGTM <TabAtkins> Rossen_: complaints, objections? <TabAtkins> RESOLVED: Go with option 2 (object/Typed OM value to specify the phase+offset), details tbd by editors |
My strawman proposal for the object would be accepting something like the following for
The name TimelineRangeOffset is based on the term name from #7701 but this could also be AnimationDelay, TimelineRange, or something else more appropriate. Using a CSSNumericValue would in theory allow for arbitrary offsets from the start / end of a range, e.g. Note that in the context of keyframe offsets #7637 the offset name does feel a bit redundant, e.g. element.animate([
{opacity: 0, offset: { offset: CSS.percent(20) }},
{opacity: 1, offset: { offset: CSS.percent(80) }}], {
delay: { rangeName: 'enter', offset: CSS.percent(0) },
endDelay: { rangeName: 'enter', offset: CSS.percent(100) },
}); |
Could you have the API automatically wrap a raw CSSNumericValue around a TimelineOffset with a null rangeName? |
If I'm following correctly, the idea is that if you specify a TimelineOffset with null rangeName it would effectively use that TimelineOffset's inner |
@flackr No, what I was wondering was if we could collapse your example:
down to
(I'm not familiar with WebIDL and JS, so my main frame of reference is C++, thus all the stupid questions...) |
Gotcha, I think this would just be accepting |
Patch implements rename based on most recent recommendation in w3c/csswg-drafts#7589. Next steps: * CSS support for animation-range. * Support for % delays. * Support for range(Start|End) as string in animation effect timing options. * Removal of <name> <percent> from animation-delay. Bug: 1383162 Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e
Patch implements rename based on most recent recommendation in w3c/csswg-drafts#7589. Next steps: * CSS support for animation-range. * Support for % delays. * Support for range(Start|End) as string in animation effect timing options. * Removal of <name> <percent> from animation-delay. * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). Bug: 1383162 Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e
Patch implements rename based on most recent recommendation in w3c/csswg-drafts#7589. Next steps: * CSS support for animation-range. * Support for % delays. * Support for range(Start|End) as string in animation effect timing options. * Removal of <name> <percent> from animation-delay. * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). Bug: 1383162 Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e
This is a reland of commit 8c67ecf3a1d46af987a2097bfa685fdc00937b43 Original change's description: > [view-timeline]: Update naming for delay as timeline offset > > Patch implements rename based on most recent recommendation in > w3c/csswg-drafts#7589. > > Next steps: > * CSS support for animation-range. > * Support for % delays. > * Support for range(Start|End) as string in animation effect timing options. > * Removal of <name> <percent> from animation-delay. > * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). > > Bug: 1383162 > Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 > Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> > Commit-Queue: Kevin Ellis <kevers@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1092031} Bug: 1383162 Change-Id: Iedd8fd8bbe0334c60ae05b746ebfc4789546b4d9
This is a reland of commit 8c67ecf Original change's description: > [view-timeline]: Update naming for delay as timeline offset > > Patch implements rename based on most recent recommendation in > w3c/csswg-drafts#7589. > > Next steps: > * CSS support for animation-range. > * Support for % delays. > * Support for range(Start|End) as string in animation effect timing options. > * Removal of <name> <percent> from animation-delay. > * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). > > Bug: 1383162 > Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 > Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> > Commit-Queue: Kevin Ellis <kevers@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1092031} Bug: 1383162 Change-Id: Iedd8fd8bbe0334c60ae05b746ebfc4789546b4d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4165261 Commit-Queue: Kevin Ellis <kevers@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1093072}
This is a reland of commit 8c67ecf3a1d46af987a2097bfa685fdc00937b43 Original change's description: > [view-timeline]: Update naming for delay as timeline offset > > Patch implements rename based on most recent recommendation in > w3c/csswg-drafts#7589. > > Next steps: > * CSS support for animation-range. > * Support for % delays. > * Support for range(Start|End) as string in animation effect timing options. > * Removal of <name> <percent> from animation-delay. > * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). > > Bug: 1383162 > Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 > Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> > Commit-Queue: Kevin Ellis <kevers@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1092031} Bug: 1383162 Change-Id: Iedd8fd8bbe0334c60ae05b746ebfc4789546b4d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4165261 Commit-Queue: Kevin Ellis <kevers@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1093072}
This is a reland of commit 8c67ecf3a1d46af987a2097bfa685fdc00937b43 Original change's description: > [view-timeline]: Update naming for delay as timeline offset > > Patch implements rename based on most recent recommendation in > w3c/csswg-drafts#7589. > > Next steps: > * CSS support for animation-range. > * Support for % delays. > * Support for range(Start|End) as string in animation effect timing options. > * Removal of <name> <percent> from animation-delay. > * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). > > Bug: 1383162 > Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 > Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> > Commit-Queue: Kevin Ellis <kevers@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1092031} Bug: 1383162 Change-Id: Iedd8fd8bbe0334c60ae05b746ebfc4789546b4d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4165261 Commit-Queue: Kevin Ellis <kevers@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1093072}
… as timeline offset, a=testonly Automatic update from web-platform-tests [view-timeline]: Update naming for delay as timeline offset Patch implements rename based on most recent recommendation in w3c/csswg-drafts#7589. Next steps: * CSS support for animation-range. * Support for % delays. * Support for range(Start|End) as string in animation effect timing options. * Removal of <name> <percent> from animation-delay. * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). Bug: 1383162 Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/main@{#1092031} -- wpt-commits: 118edd76ea99877545f88e9e313bcb88d5c9e430 wpt-pr: 37885
…or delay as timeline offset", a=testonly Automatic update from web-platform-tests Revert "[view-timeline]: Update naming for delay as timeline offset" This reverts commit 8c67ecf3a1d46af987a2097bfa685fdc00937b43. Reason for revert: LUCI Bisection identified this CL as the culprit of a build failure. See the analysis: https://luci-bisection.appspot.com/analysis/b/8792142657514411521 Sample failed build: https://ci.chromium.org/b/8792142657514411521 If this is a false positive, please report it at https://bugs.chromium.org/p/chromium/issues/entry?comment=Analysis%3A+https%3A%2F%2Fluci-bisection.appspot.com%2Fanalysis%2Fb%2F8792142657514411521&components=Tools%3ETest%3EFindit&labels=LUCI-Bisection-Wrong%2CPri-3%2CType-Bug&status=Available&summary=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F4081107 Original change's description: > [view-timeline]: Update naming for delay as timeline offset > > Patch implements rename based on most recent recommendation in > w3c/csswg-drafts#7589. > > Next steps: > * CSS support for animation-range. > * Support for % delays. > * Support for range(Start|End) as string in animation effect timing options. > * Removal of <name> <percent> from animation-delay. > * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). > > Bug: 1383162 > Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 > Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> > Commit-Queue: Kevin Ellis <kevers@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1092031} > Bug: 1383162 Change-Id: Id7c8f3ca84675b454d14a18a45aa1895c87d303f No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4162958 Commit-Queue: Jonathan Njeunje <njeunje@chromium.org> Reviewed-by: Jonathan Njeunje <njeunje@chromium.org> Owners-Override: Jonathan Njeunje <njeunje@chromium.org> Cr-Commit-Position: refs/heads/main@{#1092052} -- wpt-commits: 3103e5894fcb303d2ea34bc918fdd014cb3f78e5 wpt-pr: 37916
… as timeline offset, a=testonly Automatic update from web-platform-tests [view-timeline]: Update naming for delay as timeline offset Patch implements rename based on most recent recommendation in w3c/csswg-drafts#7589. Next steps: * CSS support for animation-range. * Support for % delays. * Support for range(Start|End) as string in animation effect timing options. * Removal of <name> <percent> from animation-delay. * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). Bug: 1383162 Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/main@{#1092031} -- wpt-commits: 118edd76ea99877545f88e9e313bcb88d5c9e430 wpt-pr: 37885
…or delay as timeline offset", a=testonly Automatic update from web-platform-tests Revert "[view-timeline]: Update naming for delay as timeline offset" This reverts commit 8c67ecf3a1d46af987a2097bfa685fdc00937b43. Reason for revert: LUCI Bisection identified this CL as the culprit of a build failure. See the analysis: https://luci-bisection.appspot.com/analysis/b/8792142657514411521 Sample failed build: https://ci.chromium.org/b/8792142657514411521 If this is a false positive, please report it at https://bugs.chromium.org/p/chromium/issues/entry?comment=Analysis%3A+https%3A%2F%2Fluci-bisection.appspot.com%2Fanalysis%2Fb%2F8792142657514411521&components=Tools%3ETest%3EFindit&labels=LUCI-Bisection-Wrong%2CPri-3%2CType-Bug&status=Available&summary=Wrongly+blamed+https%3A%2F%2Fchromium-review.googlesource.com%2Fc%2Fchromium%2Fsrc%2F%2B%2F4081107 Original change's description: > [view-timeline]: Update naming for delay as timeline offset > > Patch implements rename based on most recent recommendation in > w3c/csswg-drafts#7589. > > Next steps: > * CSS support for animation-range. > * Support for % delays. > * Support for range(Start|End) as string in animation effect timing options. > * Removal of <name> <percent> from animation-delay. > * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). > > Bug: 1383162 > Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 > Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> > Commit-Queue: Kevin Ellis <kevers@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1092031} > Bug: 1383162 Change-Id: Id7c8f3ca84675b454d14a18a45aa1895c87d303f No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4162958 Commit-Queue: Jonathan Njeunje <njeunje@chromium.org> Reviewed-by: Jonathan Njeunje <njeunje@chromium.org> Owners-Override: Jonathan Njeunje <njeunje@chromium.org> Cr-Commit-Position: refs/heads/main@{#1092052} -- wpt-commits: 3103e5894fcb303d2ea34bc918fdd014cb3f78e5 wpt-pr: 37916
…or delay as timeline offset", a=testonly Automatic update from web-platform-tests Reland "[view-timeline]: Update naming for delay as timeline offset" This is a reland of commit 8c67ecf3a1d46af987a2097bfa685fdc00937b43 Original change's description: > [view-timeline]: Update naming for delay as timeline offset > > Patch implements rename based on most recent recommendation in > w3c/csswg-drafts#7589. > > Next steps: > * CSS support for animation-range. > * Support for % delays. > * Support for range(Start|End) as string in animation effect timing options. > * Removal of <name> <percent> from animation-delay. > * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). > > Bug: 1383162 > Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 > Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> > Commit-Queue: Kevin Ellis <kevers@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1092031} Bug: 1383162 Change-Id: Iedd8fd8bbe0334c60ae05b746ebfc4789546b4d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4165261 Commit-Queue: Kevin Ellis <kevers@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1093072} -- wpt-commits: 94de74dbaa4bdab9d3d0ef0a8a3bed33ef9271d4 wpt-pr: 37934
…or delay as timeline offset", a=testonly Automatic update from web-platform-tests Reland "[view-timeline]: Update naming for delay as timeline offset" This is a reland of commit 8c67ecf3a1d46af987a2097bfa685fdc00937b43 Original change's description: > [view-timeline]: Update naming for delay as timeline offset > > Patch implements rename based on most recent recommendation in > w3c/csswg-drafts#7589. > > Next steps: > * CSS support for animation-range. > * Support for % delays. > * Support for range(Start|End) as string in animation effect timing options. > * Removal of <name> <percent> from animation-delay. > * Support range(Start|End) as CSSNumericValue (offset only with implied 'cover' as named range). > > Bug: 1383162 > Change-Id: I9d2e9572aac31c79fb937514c1f65e6940a9e27e > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081107 > Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> > Commit-Queue: Kevin Ellis <kevers@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1092031} Bug: 1383162 Change-Id: Iedd8fd8bbe0334c60ae05b746ebfc4789546b4d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4165261 Commit-Queue: Kevin Ellis <kevers@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1093072} -- wpt-commits: 94de74dbaa4bdab9d3d0ef0a8a3bed33ef9271d4 wpt-pr: 37934
The CSS Working Group just discussed
The full IRC log of that discussion<argyle> astearns: first is about timeline phases, assuming rob is going tot ake this one<argyle> flackr: lemme make things nice and simple.. <flackr> Proposed resolution in https://github.com//issues/7589#issuecomment-1380842759 <argyle> flackr: there's a proposed resolution int eh comment i linked <ydaniv> s/int eh/in the/ <argyle> flackr: this isadding the ability to the web animations API to specify ranged names and offsets whciih we have already specced for css animations <argyle> flackr: brian has looked at this proposed and agrees with the current designb, seems fine to add this to the animation options alongside the timeline attribute <argyle> flackr: this shoudl allow us to control the same thhings from javascript animations <argyle> flackr: any objections to the proposal? <argyle> astearns: i'mm looking througgh, we resolved to go with option 2. the propsed shape is? <astearns> https://github.com//issues/7589#issuecomment-1380842759 <argyle> flackr: its all consistentent with the earlier resolution, but it's not going to end delay and start delay because we moved it to it's own property <argyle> astearns: its in this comment here? <argyle> astearns: yep, this is it <argyle> astearns: alright, any opinions, concerns? <argyle> kevin ellis: moving from timing otpoins to animation options, would no logner be able to update range start/end updating timing <argyle> kevin ellis: we will need web animation api calls on the a nimation object to be able to get range start/end <argyle> kevin ellis: do we have a proposal for getter/setter or function for setting animation range programatically? <argyle> flackr: conventionally we'd do the same thing as animation timeline. getter/setter <argyle> kevin ellis: i'm in support of that, would like to see resolution <argyle> flackr: happy to make that part of the resolution <argyle> astearns: any other comments? <argyle> astearns: any concern with resolving ono this today? <argyle> astearns: proposed is to take the api shape in the linekd comment and add properties to the animation interface along timeline <bramus> SGTM <argyle> astearns: any objections to the propsoed resolution? <argyle> astearns: hearing none, we are resolved <argyle> RESOLVE: take the api shape int he linked comments and add properties to the animation interface along timeline <argyle> RESOLVEd: take the api shape int he linked comments and add properties to the animation interface along timeline <argyle> RESOLVED: take the api shape int he linked comments and add properties to the animation interface along timeline <argyle> astearns: anything more on this one? |
I believe this is resolved now with 52b620f landed. |
As part of #7044 we resolved:
These resolutions specify how in CSS you can target an animation to a particular phase of the view timeline. However, we also need a way to do the same from the web animations API. In particular the options passed for the timing of web animations are EffectTiming and OptionalEffectTiming.
Here are a few options I can think of:
delay
andendDelay
options to also accept a string specification equivalent to the CSS counterpart (e.g.delay: "enter 20%"
).delay
andendDelay
to also accept an object type representing the combination of phase and time, e.g.delay: {phase: "enter", offset: CSS.percentage(20)}
.startTime
/endTime
orphase
for specifying the "phase", "time" pairs. We would then have to decide what to do whendelay
andendDelay
are also specified.The text was updated successfully, but these errors were encountered: