From b14d0a8b358f244809df426e1a1cfd4f602146eb Mon Sep 17 00:00:00 2001 From: Stefan Zager Date: Thu, 29 May 2025 14:12:02 -0700 Subject: [PATCH 01/11] [css-animations-2] Fix bikeshed errors --- css-animations-2/Overview.bs | 173 ++++++++++++++++++----------------- 1 file changed, 87 insertions(+), 86 deletions(-) diff --git a/css-animations-2/Overview.bs b/css-animations-2/Overview.bs index 070e600bba9..d204cc09600 100644 --- a/css-animations-2/Overview.bs +++ b/css-animations-2/Overview.bs @@ -37,6 +37,8 @@ urlPrefix: https://dom.spec.whatwg.org/; type: dfn; spec: dom text: event target

Delta specification

@@ -127,12 +129,12 @@ the changes from the programming interface take precedence as follows: or after successfully setting the {{Animation/startTime}} on a {{CSSAnimation}}, if, as a result of that call the [=play state=] of the - {{CSSAnimation}} changes to or from the [=paused play state=], + {{CSSAnimation}} changes to or from the [=play state/paused=] play state, any subsequent change to the 'animation-play-state' will no longer cause the {{CSSAnimation}} to be played or paused as defined in [[#animation-play-state]]. - The requirement for a change to or from the [=paused play state=] + The requirement for a change to or from the [=play state/paused=] state ensures that even after calling {{Animation/reverse()}} or setting the {{Animation/startTime}} on a running animation, @@ -265,15 +267,14 @@ roughly the same composite order. CSS Animations generated using the markup defined in this specification are not added to the global animation list when they are created. Instead, these animations are appended to the global animation list at -the first moment when they transition out of the idle play state after -being disassociated from their owning element. +the first moment when they transition out of the [=play state/idle=] play state +after being disassociated from their owning element. CSS Animations that have been disassociated from their owning element -but are still idle do not have a defined -composite order. +but are still [=play state/idle=] do not have a defined composite order. Note, this behavior relies on the fact that disassociating an animation from its owning element always causes it to enter (or remain) in the -idle play state. +[=play state/idle=] play state.

Assembling Keyframes

@@ -286,7 +287,7 @@ See [[css-animations-1#keyframes]].

Processing Keyframes

-For each animation effect defined by the Nth item +For each animation effect defined by the Nth item in the [=coordinated value list=] of the 'animation-*' properties on target (pseudo-)element |element|, its associated [=keyframes=] are generated as follows: @@ -306,7 +307,7 @@ its associated [=keyframes=] are generated as follows: |keyframe composite|, and |keyframe values|. - * Let |animated properties| be an empty set of CSS property names. + * Let |animated properties| be an empty set of CSS [=property names=]. 1. Collect Declared Keyframes: 1. Find the last ''@keyframes'' at-rule in document order @@ -320,7 +321,7 @@ its associated [=keyframes=] are generated as follows: In this case no animation is generated, and any existing animation matching |name| is canceled. - 1. Group together all [=keyframe blocks=] + 1. Group together all keyframe blocks that share the same [=specified value|specified=] <> (treating ''@keyframe/from'' as ''0%'' and ''@keyframe/to'' as ''100%''), last declared 'animation-timing-function' [=computed value=] @@ -343,14 +344,14 @@ its associated [=keyframes=] are generated as follows: and map together corresponding property pairs in each [=logical property group=] according to the |element|’s [=computed value|computed=] [=writing mode=]. - 1. Append to |keyframes| a new empty [=keyframe=] |keyframe| + 1. Append to |keyframes| a new empty [=keyframe=] with the group’s |keyframe offset|, |keyframe timing function|, and |keyframe composite|. Give its |keyframe values| the set of [=declared values=] resulting from this cascade. - 1. Add each property name that was added to its |keyframe properties| + 1. Add each [=property name=] that was added to its {{CSSKeyframesRule/cssRules}} to |animated properties|. 1. Generate Initial and Final Frames: @@ -470,11 +471,11 @@ Declaring Animations If the [=used value|used=] 'animation-duration' is ''0s'', the animation itself still occurs (instantaneously). The animation’s start and end events are still fired. - If 'animation-fill-mode' is set to ''backwards'' or ''both'', + If 'animation-fill-mode' is set to ''single-animation-fill-mode/backwards'' or ''single-animation-fill-mode/both'', the first frame of the animation (as defined by 'animation-direction') will be displayed during the 'animation-delay'; - and if 'animation-fill-mode' is set to ''forwards'' or ''both'', + and if 'animation-fill-mode' is set to ''single-animation-fill-mode/forwards'' or ''single-animation-fill-mode/both'', the last frame of the animation (as defined by 'animation-direction') will be displayed after the 'animation-delay'. @@ -746,25 +747,25 @@ The values of 'animation-trigger-behavior' have the following meaning for an [=animation trigger=] that enters its [=animation trigger/active interval|active interval=]:
-
once -
- The animation is triggered and played once and only once. - -
repeat -
- The animation is played from the beginning each time it is triggered. - When the trigger’s [=animation trigger/active interval=] is exited the animation is reset. - -
alternate -
- The animation is played forwards, according to its [=playback direction=], each time it is triggered. - When the trigger’s [=animation trigger/active interval=] is exited the animation is reversed. - -
state -
- The animation is triggered and played once. - When the trigger’s [=animation trigger/active interval=] is exited the animation is paused. - When the trigger’s [=animation trigger/active interval=] is re-entered the animation is resumed. +
once +
+ The animation is triggered and played once and only once. + +
repeat +
+ The animation is played from the beginning each time it is triggered. + When the trigger’s [=animation trigger/active interval=] is exited the animation is reset. + +
alternate +
+ The animation is played forwards, according to its [=playback direction=], each time it is triggered. + When the trigger’s [=animation trigger/active interval=] is exited the animation is reversed. + +
state +
+ The animation is triggered and played once. + When the trigger’s [=animation trigger/active interval=] is exited the animation is paused. + When the trigger’s [=animation trigger/active interval=] is re-entered the animation is resumed.
The behavior of each value is defined in [[web-animations-2#trigger-behaviors]]. @@ -858,7 +859,7 @@ The 'animation-trigger-exit-range' property is a [=shorthand property|shorthand= that sets 'animation-trigger-exit-range-start' and 'animation-trigger-exit-range-end' together in a single declaration, specifying the [=animation trigger=]’s associated [=exit range=]. -It has the same syntax as the 'animation-range' property, with the addition of the ''auto'' keyword. +It has the same syntax as the 'animation-range' property, with the addition of the ''animation-trigger-exit-range-start/auto'' keyword. The [=exit range=] replaces the [=default range=] once the [=animation trigger=]’s [=animation trigger/active interval|active interval=] is entered, @@ -888,31 +889,31 @@ associated [=exit range=]. The values of 'animation-trigger-exit-range-start' have the following meaning:
-
auto -
- The start of the trigger’s [=exit range=] - is equal to the start of its [=default range=]. - -
normal -
- The start of the trigger’s [=exit range=] - is the start of its associated [=timeline=]; - the start of the trigger’s [=animation trigger/active interval|active interval=] - is determined as normal. - -
<> -
- The [=exit range=] starts - at the specified point on the [=timeline=] - measuring from the start of the timeline. - -
<> <>? -
- The [=exit range=] starts - at the specified point on the [=timeline=] - measuring from the start of the specified [=named timeline range=]. - If the <> is omitted, - it defaults to 0%. +
auto +
+ The start of the trigger’s [=exit range=] + is equal to the start of its [=default range=]. + +
normal +
+ The start of the trigger’s [=exit range=] + is the start of its associated [=timeline=]; + the start of the trigger’s [=animation trigger/active interval|active interval=] + is determined as normal. + +
<> +
+ The [=exit range=] starts + at the specified point on the [=timeline=] + measuring from the start of the timeline. + +
<> <>? +
+ The [=exit range=] starts + at the specified point on the [=timeline=] + measuring from the start of the specified [=named timeline range=]. + If the <> is omitted, + it defaults to 0%.
## The 'animation-trigger-exit-range-end' property ## {#animation-trigger-exit-range-end} @@ -934,31 +935,31 @@ associated [=exit range=]. The values of 'animation-trigger-exit-range-start' have the following meaning:
-
auto -
- The end of the trigger’s [=exit range=] - is equal to the end of its [=default range=]. - -
normal -
- The end of the trigger’s [=exit range=] - is the end of its associated [=timeline=]; - the end of the trigger’s [=animation trigger/active interval|active interval=] - is determined as normal. - -
<> -
- The [=exit range=] ends - at the specified point on the [=timeline=] - measuring from the start of the timeline. - -
<> <>? -
- The [=exit range=] ends - at the specified point on the [=timeline=] - measuring from the start of the specified [=named timeline range=]. - If the <> is omitted, - it defaults to 100%. +
auto +
+ The end of the trigger’s [=exit range=] + is equal to the end of its [=default range=]. + +
normal +
+ The end of the trigger’s [=exit range=] + is the end of its associated [=timeline=]; + the end of the trigger’s [=animation trigger/active interval|active interval=] + is determined as normal. + +
<> +
+ The [=exit range=] ends + at the specified point on the [=timeline=] + measuring from the start of the timeline. + +
<> <>? +
+ The [=exit range=] ends + at the specified point on the [=timeline=] + measuring from the start of the specified [=named timeline range=]. + If the <> is omitted, + it defaults to 100%.
## The 'animation-trigger' property ## {#animation-trigger} From a00f16cb982ecbbfdddaf3c1d722694f7c7cf1ef Mon Sep 17 00:00:00 2001 From: Stefan Zager Date: Thu, 29 May 2025 14:52:23 -0700 Subject: [PATCH 02/11] [web-animations-2] Spec for event-based animation triggers --- css-animations-2/Overview.bs | 48 +++++++++++++++++++++- web-animations-2/Overview.bs | 78 +++++++++++++++++++++++++++++------- 2 files changed, 111 insertions(+), 15 deletions(-) diff --git a/css-animations-2/Overview.bs b/css-animations-2/Overview.bs index d204cc09600..8a95f03ee15 100644 --- a/css-animations-2/Overview.bs +++ b/css-animations-2/Overview.bs @@ -307,7 +307,7 @@ its associated [=keyframes=] are generated as follows: |keyframe composite|, and |keyframe values|. - * Let |animated properties| be an empty set of CSS [=property names=]. + * Let |animated properties| be an empty set of CSS property names. 1. Collect Declared Keyframes: 1. Find the last ''@keyframes'' at-rule in document order @@ -962,6 +962,52 @@ The values of 'animation-trigger-exit-range-start' have the following meaning: it defaults to 100%. +## The 'animation-trigger-name' property ## {#animation-trigger-name} + +The 'animation-trigger-name' property is used to associate an {{Element}} with +all [=event-based animation triggers=] whose [=animation trigger name=] matches +the property value. When an {{Event}} is dispatched +with the associated {{Element}} as {{Event/target}}, +and with {{Event/type}} matching an associated trigger's {{animation trigger/event type}}, +the trigger performs its effect on its associated [=animation=]. + +
+Name: animation-trigger-name
+Value: none | [ <> ]#
+Initial: none
+Applies to: all elements
+Inherited: no
+Percentages: N/A
+Computed value: the keyword ''animation-trigger-none'', or a list of case-sensitive css identifiers
+Animation type: not animatable
+
+ +
<trigger-name> = <>
+ +## The 'animation-trigger-event' property ## {#animation-trigger-event} + +The 'animation-trigger-event' property is used to specify the criteria +for an [=event-based animation trigger=] +to perform its effect on its associated [=animation=]. It consists of two parts: +an event type that is matched against the {{Event/type}} of a dispatched {{Event}}, +and a trigger name that is matched against the 'animation-trigger-name' property +of the event's {{Event/target}}. If both criteria match for a given event +the trigger will perform its effect on its associated [=animation=]. + +
+Name: animation-trigger-event
+Value: none | [ <> ]#
+Initial: none
+Applies to: all elements
+Inherited: no
+Percentages: N/A
+Computed value: the keyword ''animation-trigger-event/none'' or a list of case-sensitive css identifiers
+Animation type: not animatable
+
+ +
<single-trigger-event> = <> ( <> )
+
<trigger-event-type> = <>
+ ## The 'animation-trigger' property ## {#animation-trigger} The 'animation-trigger' property is a [=shorthand property|shorthand=] diff --git a/web-animations-2/Overview.bs b/web-animations-2/Overview.bs index 7e244743076..8d0a4e2053d 100644 --- a/web-animations-2/Overview.bs +++ b/web-animations-2/Overview.bs @@ -143,6 +143,7 @@ urlPrefix: http://www.ecma-international.org/ecma-262/6.0/#sec-; type: dfn; spec text: execution contexts urlPrefix: https://drafts.csswg.org/scroll-animations-1/; type: dfn; spec: scroll-animations-1 text: html-processing-model-event-loops +#interface-event