-
Notifications
You must be signed in to change notification settings - Fork 746
[css-animations-2] Specify the animation-trigger property #10128
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
Changes from 1 commit
133f6e0
f3a49ba
cbd4f07
9f6464a
912426a
9ae1a13
f1d2e89
e55e476
a0e90fe
361f5d9
efa38c7
085618e
11e3138
7777ac1
e3554e3
cef7a04
079135c
65b0533
5f2615b
4109b39
c8eb479
6a6bf45
c74c5c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,7 @@ Abstract: This specification defines a model for synchronization and | |
specifications will define declarative means for exposing these | ||
features. | ||
Ignored Vars: auto-rewind, current direction, index, 5CC0 initial progress, | ||
timeline, new timeline, t, going forwards | ||
timeline, new timeline, t, going forwards, did trigger | ||
</pre> | ||
<pre class="anchors"> | ||
urlPrefix: https://drafts.csswg.org/web-animations-1/; type: dfn; spec: web-animations-1 | ||
|
@@ -122,6 +122,7 @@ urlPrefix: https://drafts.csswg.org/web-animations-1/; type: dfn; spec: web-anim | |
text: play an animation | ||
text: playback direction | ||
text: pause an animation | ||
text: reverse an animation | ||
text: ready | ||
text: set the timeline of an animation | ||
text: simple iteration progress | ||
|
@@ -2353,6 +2354,142 @@ Items sorted earlier are executed before those sorted later. | |
|
||
</ins> | ||
|
||
Animation Triggers {#triggers} | ||
----------------- | ||
|
||
### Overview ### {#triggers-overview} | ||
|
||
An <dfn export>animation trigger</dfn> is used to control the playback | ||
of its associated [=animation=] for time-driven animations. | ||
Like animations, [=animation triggers=] are associated with a [=timeline=] | ||
and are attached to an [=animation attachment range|attachment range=]. | ||
|
||
Issue: Should there be any effect of triggers on scroll-driven animations? | ||
|
||
### Animation Trigger State ### {#trigger-state} | ||
|
||
An [=animation trigger=] |trigger| with [=animation trigger type=] |type| | ||
and an associated [=animation=] |animation| | ||
has an internal <dfn export lt="animation trigger state">state</dfn> that can be one of the following: | ||
|
||
<dl dfn-for="animation trigger state" dfn-type=value> | ||
<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> | ||
The ''primary'' effect defined by |type| is applied to |animation|. | ||
|
||
<dt><dfn>inverse</dfn> | ||
<dd> | ||
The ''inverse'' effect defined by |type| is applied to |animation|. | ||
|
||
</dl> | ||
|
||
Issue: Do we need a formal resolution on the spec of the idle state? | ||
|
||
The [=animation trigger state=] |state| of an [=animation trigger=] |trigger| | ||
is controlled by the [=animation attachment range|attachment range=] it is attached to, | ||
given a flag |did trigger|, as follows: | ||
|
||
|
||
<dl class=switch> | ||
: If |trigger|’s [=local time=] is [=unresolved=], | ||
:: | ||
Then |state| is ''animation trigger state/idle'', and |did trigger| is set to false. | ||
|
||
|
||
: Otherwise, | ||
:: | ||
|
||
<dl class=switch> | ||
: If |trigger| is inside its [=active interval=], | ||
:: | ||
Then |state| is ''animation trigger state/primary'', and |did trigger| is set to true. | ||
|
||
: Otherwise, | ||
:: | ||
|
||
<dl class=switch> | ||
: If |did trigger| flag is false, | ||
:: | ||
Then |state| is ''animation trigger state/idle''. | ||
|
||
: Otherwise, | ||
:: | ||
|state| is ''animation trigger state/inverse''. | ||
|
||
</dl> | ||
|
||
</dl> | ||
|
||
</dl> | ||
|
||
### Animation Trigger Types ### {#trigger-types} | ||
|
||
The behavior an [=animation trigger=] applies to its associated [=animation=]’s | ||
playback is defined by its <dfn export>animation trigger type</dfn>, | ||
which can be one of the following: | ||
|
||
<dl dfn-type=value dfn-for='animat 6968 ion trigger type'> | ||
<dt><dfn>once</dfn> | ||
<dd> | ||
The ''primary'' behavior is [=play an animation|triggering=] the associated animation. | ||
|
||
|
||
<dt><dfn>repeat</dfn> | ||
<dd> | ||
The ''primary'' behavior is [=play an animation|triggering=] the associated animation. | ||
The ''inverse'' behavior is resetting the [=animation trigger state=] back to ''animation trigger state/idle''. | ||
|
||
<dt><dfn>alternate</dfn> | ||
<dd> | ||
<dl class=switch> | ||
: if the |did trigger| flag is false, | ||
:: | ||
The ''primary'' behavior is [=play an animation|triggering=] the associated animation. | ||
|
||
: Otherwise, | ||
:: | ||
The ''primary'' behavior is [=reverse an animation|reversing=] the associated animation. | ||
|
||
</dl> | ||
|
||
The ''inverse'' behavior is [=reverse an animation|reversing=] the associated animation. | ||
|
||
<dt><dfn>state</dfn> | ||
|
||
<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. | ||
</dl> | ||
|
||
Issue: Need to bike-shed the name for type "state" type. | ||
|
||
### Animation Trigger Ranges ### {#trigger-ranges} | ||
|
||
An [=animation trigger=] has at least one [=animation attachment range|range=], | ||
|
||
its <dfn>default range</dfn>, which defines its [=active interval=]. | ||
This range defines when the [=animation trigger|trigger=] is in its ''animation trigger state/primary'' state, | ||
as specified in [[#trigger-state]]. | ||
|
||
An [=animation trigger=] may also have a second [=animation attachment range|range=], | ||
the <dfn>exit range</dfn>. The [=exit range=] is used to replace [=default range=] and extend | ||
the [=active interval=] of an [=animation trigger=] |trigger| as follows: | ||
|
||
<dl class=switch> | ||
: If |trigger| is inside its [=active interval=], | ||
:: | ||
It’s attached to its [=exit range=]. | ||
|
||
: Otherwise, | ||
:: | ||
It’s attached to its [=default range=]. | ||
|
||
</dl> | ||
|
||
Issue: Should we specify that that exit range’s edges can only be equal to or greater than the default range’s edges? | ||
|
||
Issue: Do we need to specify the process for determining the effective attachment range in the HTML Processing Model? | ||
|
||
<!-- End of animation model --> | ||
|
||
<h2 id="programming-interface">Programming interface</h2> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bit of a mismatch between this and the text in css-animations-2 where the text for single-animation-trigger-type specifies when the effect is applied. The text above implies that the effect is applied continually while in the state, but the text in single-animation-trigger-type implies that the effect is applied at a discrete moment in time. If all of the effects are discrete then I think it would be simpler to have the effect explicitly only invoked when the trigger's state changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried making that more explicit in the text, LMK if that's good