diff --git a/css-animations-2/Overview.bs b/css-animations-2/Overview.bs index 647e64b169d..4b6a09829f3 100644 --- a/css-animations-2/Overview.bs +++ b/css-animations-2/Overview.bs @@ -962,14 +962,67 @@ The values of 'animation-trigger-exit-range-start' have the following meaning: it defaults to 100%. +## The 'trigger-name' property ## {#trigger-name} + +The 'trigger-name' property causes an [=event-based animation trigger=] to be created +for any animation whose target element has an 'animation-trigger-event' property +with matching <>. +When an {{Event}} is dispatched with the element having the matching 'trigger-name' property +as {{Event/target}}, +and with {{Event/type}} matching the <> of the +'animation-trigger-event' property on the animation target, the animation's +playback is modified according to its +'animation-trigger-behavior' property, as described for +[=event-based animation triggers=]. + +
+Name: trigger-name
+Value: none | [ <> ]#
+Initial: none
+Applies to: all elements
+Inherited: no
+Percentages: N/A
+Computed value: as specified
+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 [=qualifying events=] that cause an [=event-based animation trigger=] +to perform its effect on its associated [=animation=]. It consists of two parts: +a <> that is matched against the {{Event/type}} of a dispatched {{Event}}, +and an <> that is matched against the '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=]. + +If the <> is omitted from <> declaration, +{{Event/target}} is matched against the element +having the 'animation-trigger-event' property itself. + +
+Name: animation-trigger-event
+Value: none | [ <> ]#
+Initial: none
+Applies to: all elements
+Inherited: no
+Percentages: N/A
+Computed value: as specified
+Animation type: not animatable
+
+ +
<single-event-trigger> = event ( <> <>? )
+
<trigger-event-type> = <>
+ ## The 'animation-trigger' property ## {#animation-trigger} The 'animation-trigger' property is a [=shorthand property|shorthand=] that sets 'animation-trigger-behavior', 'animation-trigger-timeline', -'animation-trigger-range-start', 'animation-trigger-range-end', +'animation-trigger-event', 'animation-trigger-range-start', 'animation-trigger-range-end', 'animation-trigger-exit-range-start', and 'animation-trigger-exit-range-end' -together in a single declaration, -specifying the [=animation trigger=] for an animation. +together in a single declaration, specifying the [=animation trigger=] for an animation.
 Name: animation-trigger
@@ -984,7 +1037,9 @@ Animation Type: not animatable
 
-<single-animation-trigger> = <> || [ none | auto | [ [ <> | <> | <> ] [ normal | <> | <> <>? ]{0,4} ] ]
+<single-animation-trigger> = <> || [ <> | <> ]
+
+<single-timeline-trigger> = none | auto | [ <> | <> | <> ] [ normal | <> | <> <>? ]{0,4}
 
# Animation Events # {#events} diff --git a/web-animations-2/Overview.bs b/web-animations-2/Overview.bs index 7e244743076..ca22461fef2 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 +Issue: Should not use type `any` for the range attributes. +
: AnimationTrigger(|options|) :: Creates a new {{AnimationTrigger}} object using the following procedure: - 1. Create a new {{AnimationTrigger}} object, |trigger|. + 1. If |options| contains a {{AnimationTriggerOptions/timeline}} entry + and also contains either or both of + {{AnimationTriggerOptions/eventTarget}} and {{AnimationTriggerOptions/eventType}} + throw a TypeError. - 1. Set |trigger|.[=did trigger=] to false. + 1. If |options| contains only one of + {{AnimationTriggerOptions/eventTarget}} and {{AnimationTriggerOptions/eventType}} + throw a TypeError. - 1. Set |trigger|.[=animation trigger state|state=] to [=animation trigger state/idle=]. + 1. Create a new {{AnimationTrigger}} object, |trigger|. 1. Set |trigger|.{{AnimationTrigger/behavior}} to |options|.{{AnimationTriggerOptions/behavior}}. - 1. Set [=default range=] of |trigger| using |options|.{{AnimationTriggerOptions/rangeStart}} and |options|.{{AnimationTriggerOptions/rangeEnd}}, - following the same rules as the KeyframeAnimationOption - rangeStart and - rangeEnd respectively. + 1. If |options| contains a {{AnimationTriggerOptions/timeline}} entry + 1. Set |trigger|.[=did trigger=] to false. - 1. Set [=exit range=] of |trigger| using |options|.{{AnimationTriggerOptions/exitRangeStart}} and |options|.{{AnimationTriggerOptions/exitRangeEnd}}, - following the same rules above for [=default range=], unless they are set to - "auto", in which case they are set to their corresponding side - of the [=default range=]. + 1. Set |trigger|.[=animation trigger state|state=] to [=animation trigger state/idle=]. - 1. Run the procedure for [=setting timeline of animation trigger=] - on |trigger| passing |options|.{{AnimationTriggerOptions/timeline}} as the new timeline. + 1. Set [=default range=] of |trigger| using + |options|.{{AnimationTriggerOptions/rangeStart}} and |options|.{{AnimationTriggerOptions/rangeEnd}} + following the same rules as the KeyframeAnimationOption + rangeStart and + rangeEnd respectively. + + 1. Set [=exit range=] of |trigger| using |options|.{{AnimationTriggerOptions/exitRangeStart}} and |options|.{{AnimationTriggerOptions/exitRangeEnd}}, + following the same rules above for [=default range=], unless they are set to + "auto", in which case they are set to their corresponding side + of the [=default range=]. + + 1. Run the procedure for [=setting timeline of animation trigger=] + on |trigger| passing |options|.{{AnimationTriggerOptions/timeline}} + as the new timeline. + + 1. If |options| contains {{AnimationTriggerOptions/eventTarget}} and + {{AnimationTriggerOptions/eventType}} entries + 1. Set |trigger|.{{AnimationTrigger/eventTarget}} to |options|.{{AnimationTriggerOptions/eventTarget}}. + + 1. Set |trigger|.{{AnimationTrigger/eventType}} to |options|.{{AnimationTriggerOptions/eventType}}.
@@ -3670,15 +3753,26 @@ interface AnimationTrigger {
+ : behavior + :: + + : eventTarget + :: + For an [=event-based animation trigger=], this is + matched against a dispatched event's {{Event/target}} + to determine whether it's a [=animation trigger/qualifying event=]. + + : eventType + :: + For an [=event-based animation trigger=], this is + matched against a dispatched event's {{Event/type}} + to determine whether it's a [=animation trigger/qualifying event=]. + : timeline :: Returns the [=timeline=] for this trigger or `null` if this timeline is [=inactive timeline|inactive=]. - : behavior - :: - Returns the [=animation trigger behavior|behavior=] of this trigger. - : rangeStart :: Returns the [=default range=]’s start of this trigger. @@ -3695,14 +3789,18 @@ interface AnimationTrigger { :: Returns the [=exit range=]’s end of this trigger. +Issue: Need to specify the behavior of setters. +

The AnimationTriggerOptions dictionary

 dictionary AnimationTriggerOptions {
+  AnimationTriggerBehavior behavior = "once";
+  EventTarget? eventTarget;
+  DOMString? eventType;
   AnimationTimeline? timeline;
-  AnimationTriggerBehavior? behavior = "once";
   (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) rangeStart = "normal";
   (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) rangeEnd = "normal";
   (TimelineRangeOffset or CSSNumericValue or CSSKeywordValue or DOMString) exitRangeStart = "auto";
@@ -3713,16 +3811,24 @@ dictionary AnimationTriggerOptions {
 
- : timeline - :: - The timeline to which the trigger is associated. - If not specified, the trigger is associated with [=default document timeline=]. - : behavior :: The behavior of the trigger. If not specified, the trigger's behavior is ''animation-trigger-type/once''. + : eventTarget + :: + The {{EventTarget!!interface}} for an [=event-based animation trigger=]. + + : eventType + :: + The {{Event/type}} for an [=event-based animation trigger=]. + + : timeline + :: + The timeline to which a [=timeline-based animation trigger=] is associated. + If not specified, the trigger is associated with [=default document timeline=]. + : rangeStart :: The start of the trigger’s [=default range=].