Skip to content

Commit

Permalink
[web-animations-2] Use dfn type for animation trigger values (#11664)
Browse files Browse the repository at this point in the history
* [web-animations-2] Use `dfn` type for animation trigger values

The values for "animation trigger state" and "animation trigger type" were
defined with a `value` definition type. That type is reserved for CSS values:
https://speced.github.io/bikeshed/#dfn-types

This makes tools that crawl specs to extract machine-readable information
wrongly assume that the spec introduces new CSS values.

There is no specific definition type available for generic values. This update
uses a regular `dfn` and updates references to these values accordingly.

* Link animation trigger type values back to dfns in css-animations-2

Per feedback, the values are indeed CSS values for the `animation-trigger-type`
property defined in CSS Animations 2. This update replaces the definitions in
web-animations-2 by references to the definitions in CSS Animations 2 not to
end up with two places that define the values.
  • Loading branch information
tidoust authored Feb 7, 2025
1 parent 95b4254 commit 07e98f6
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions web-animations-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2379,40 +2379,40 @@ Issue: Should there be any effect of triggers on scroll-driven animations?
The behavior an [=animation trigger=] applies to its associated [=animation=]’s
playback is defined by its <dfn export>animation trigger type</dfn>, and
depending on its [=animation trigger state|state=] can apply one of two
distinct behavior types: ''primary'' or ''inverse''.
distinct behavior types: [=animation trigger state/primary=] or [=animation trigger state/inverse=].
Given an internal |did trigger| flag, the values of [=animation trigger type=]
can be one of the following:

<dl dfn-type=value dfn-for='animation trigger type'>
<dt><dfn>once</dfn>
<dl>
<dt>''animation-trigger-type/once''
<dd>
The ''primary'' behavior is [=play an animation|triggering=] the associated animation.
The [=animation trigger state/primary=] behavior is [=play an animation|triggering=] the associated animation.

<dt><dfn>repeat</dfn>
<dt>''animation-trigger-type/repeat''
<dd>
The ''primary'' behavior is [=play an animation|triggering=] the associated animation.
The ''inverse'' behavior is resetting the associated [=animation effect=] back to
The [=animation trigger state/primary=] behavior is [=play an animation|triggering=] the associated animation.
The [=animation trigger state/inverse=] behavior is resetting the associated [=animation effect=] back to
its [=animation effect/before phase=] and its associated animation’s [=animation/start time=] to zero.

<dt><dfn>alternate</dfn>
<dt>''animation-trigger-type/alternate''
<dd>
<dl class=switch>
: if the |did trigger| flag is false,
::
The ''primary'' behavior is [=play an animation|triggering=] the associated animation.
The [=animation trigger state/primary=] behavior is [=play an animation|triggering=] the associated animation.

: Otherwise,
::
The ''primary'' behavior is [=reverse an animation|reversing=] the associated animation.
The [=animation trigger state/primary=] behavior is [=reverse an animation|reversing=] the associated animation.

</dl>

The ''inverse'' behavior is [=reverse an animation|reversing=] the associated animation.
The [=animation trigger state/inverse=] behavior is [=reverse an animation|reversing=] the associated animation.

<dt><dfn>state</dfn>
<dt>''animation-trigger-type/state''
<dd>
The ''primary'' behavior is [=play an animation|triggering or resuming=] the associated animation.
The ''inverse'' behavior is [=pause an animation|pausing=] the associated animation.
The [=animation trigger state/primary=] behavior is [=play an animation|triggering or resuming=] the associated animation.
The [=animation trigger state/inverse=] behavior is [=pause an animation|pausing=] the associated animation.
</dl>

Issue: Need to bike-shed the name for type "state" type.
Expand All @@ -2427,19 +2427,19 @@ has an internal <dfn export lt="animation trigger state">state</dfn> which
controls the applied behavior type. This state has discrete values
which can be one of the following:

<dl dfn-for="animation trigger state" dfn-type=value>
<dl dfn-for="animation trigger state">
<dt><dfn>idle</dfn>
<dd>
The [=animation effect=] associated |animation| remains in
its [=animation effect/before phase=] and stays at zero [=animation/start time=].

<dt><dfn>primary</dfn>
<dd>
When switched to this value the ''primary'' behavior type defined by |type| is applied to |animation|.
When switched to this value the [=animation trigger state/primary=] behavior type defined by |type| is applied to |animation|.

<dt><dfn>inverse</dfn>
<dd>
When switched to this value the ''inverse'' behavior type defined by |type| is applied to |animation|.
When switched to this value the [=animation trigger state/inverse=] behavior type defined by |type| is applied to |animation|.

</dl>

Expand All @@ -2449,7 +2449,7 @@ Issue: Do we need a formal resolution on the spec of the idle state?

Each [=animation trigger=] defines an <dfn for="animation trigger">active interval</dfn>
and only one such interval. This interval is the segment of the timeline’s progress
during which the trigger’s [=animation trigger state|state=] is set to ''primary''.
during which the trigger’s [=animation trigger state|state=] is set to [=animation trigger state/primary=].

### Animation Trigger Ranges ### {#trigger-ranges}

Expand All @@ -2464,7 +2464,7 @@ Depending on its most recent [=animation trigger state|state=] |state|, the
[=animation trigger/active interval|active interval=] is defined as follows:

<dl class=switch>
: If |state| is ''animation trigger state/primary'',
: If |state| is [=animation trigger state/primary=],
::
Then |interval| is set to [=exit range=].

Expand Down Expand Up @@ -2515,7 +2515,7 @@ Depending on its most recent [=animation trigger state|state=] |state|, the
1. Let |did trigger| be a boolean flag that is initially false.

1. Let |state| be the current [=animation trigger state|state=]
of |trigger| that is initially ''animation trigger state/idle''.
of |trigger| that is initially [=animation trigger state/idle=].

1. Set |state| as follows:
<dl class=switch>
Expand All @@ -2527,7 +2527,7 @@ Depending on its most recent [=animation trigger state|state=] |state|, the
::

<dl class=switch>
: If |type| is ''animation trigger type/once'' and |did trigger| flag is true,
: If |type| is 'animation-trigger-type/once'' and |did trigger| flag is true,
::
Then abort this procedure.

Expand All @@ -2537,7 +2537,7 @@ Depending on its most recent [=animation trigger state|state=] |state|, the
<dl class=switch>
: If |trigger| is inside its [=animation trigger/active interval|active interval=],
::
1. Set |state| to ''animation trigger state/primary''.
1. Set |state| to [=animation trigger state/primary=].
1. Set |did trigger| to true.

: Otherwise,
Expand All @@ -2546,7 +2546,7 @@ Depending on its most recent [=animation trigger state|state=] |state|, the
<dl class=switch>
: If |did trigger| flag is true,
::
Set |state| to ''animation trigger state/inverse''.
Set |state| to [=animation trigger state/inverse=].

</dl>

Expand Down Expand Up @@ -3713,7 +3713,7 @@ dictionary AnimationTriggerOptions {
: <dfn>type</dfn>
::
The type of trigger to create.
If not specified, the trigger is of type ''animation trigger type/once''.
If not specified, the trigger is of type ''animation-trigger-type/once''.

: <dfn>rangeStart</dfn>
::
Expand Down Expand Up @@ -3748,19 +3748,19 @@ enum AnimationTriggerType { "once", "repeat", "alternate", "state" };

: <dfn>once</dfn>
::
Type ''animation trigger type/once''.
Type ''animation-trigger-type/once''.

: <dfn>repeat</dfn>
::
Type ''animation trigger type/repeat''.
Type ''animation-trigger-type/repeat''.

: <dfn>alternate</dfn>
::
Type ''animation trigger type/alternate''.
Type ''animation-trigger-type/alternate''.

: <dfn>state</dfn>
::
Type ''animation trigger type/state''.
Type ''animation-trigger-type/state''.

</dl>

Expand Down

0 comments on commit 07e98f6

Please sign in to comment.