Skip to content

Commit ebda50a

Browse files
[web-animations-1][web-animations-2] Move iterationComposite to web-animations-2 (#4303)
See #4300
1 parent 77dfa9f commit ebda50a

File tree

2 files changed

+163
-99
lines changed

2 files changed

+163
-99
lines changed

web-animations-1/Overview.bs

Lines changed: 14 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ urlPrefix: https://drafts.csswg.org/css-writing-modes-4/; type: dfn; spec: css-w
190190
text: equivalent physical property; url: logical-to-physical
191191
urlPrefix: https://drafts.csswg.org/css-style-attr/; type: dfn; spec: css-style-attr
192192
text: style attribute
193+
urlPrefix: https://drafts.csswg.org/web-animations-2/; type: dfn; spec: web-animations-2
194+
text: iteration composite operation
195+
text: iteration composite operation accumulate
193196
</pre>
194197
<pre class="link-defaults">
195198
spec:dom; type:interface; text:DocumentOrShadowRoot
@@ -3321,10 +3324,9 @@ a <a>target element</a> for which computed property values can be calculated.
33213324
<h4 id="the-effect-value-of-a-keyframe-animation-effect">The effect value of
33223325
a keyframe effect</h4>
33233326

3324-
The <a>effect value</a> of a single property
3325-
referenced by a <a>keyframe effect</a> as one of its
3326-
<a lt="target property">target properties</a>, for a given
3327-
<var>iteration progress</var>, <var>current iteration</var> and
3327+
The <a>effect value</a> of a single property referenced by a <a>keyframe
3328+
effect</a> as one of its <a lt="target property">target properties</a>, for a
3329+
given <var>iteration progress</var>, <var ignore=''>current iteration</var> and
33283330
<var>underlying value</var> is calculated as follows.
33293331

33303332
1. If <var>iteration progress</var> is <a>unresolved</a> abort this
@@ -3422,30 +3424,6 @@ referenced by a <a>keyframe effect</a> as one of its
34223424
corresponding to the <var>target property</var>'s
34233425
<a>animation type</a>.
34243426

3425-
1. If this <a>keyframe effect</a> has an <a>iteration
3426-
composite operation</a> of <a
3427-
lt="iteration composite operation accumulate">accumulate</a>,
3428-
apply the following step <var>current iteration</var> times:
3429-
3430-
* replace the property value of <var>target property</var>
3431-
on <var>keyframe</var> with the result of combining the
3432-
property value on the final keyframe in <var>property-specific
3433-
keyframes</var> (<var>V</var><sub>a</sub>) with the
3434-
property value on <var>keyframe</var>
3435-
(<var>V</var><sub>b</sub>) using the <a
3436-
lt="value accumulation">accumulation procedure</a>
3437-
defined for <var>target property</var>.
3438-
3439-
Note: The order of arguments here is important. In the case where
3440-
the animation type of the target property does not define a
3441-
procedure for accumulation or addition, the default definition
3442-
for these procedures result in <var>V</var><sub>b</sub> being
3443-
returned. When performing iteration composition on propreties
3444-
that do not support accumulation, the result should be the
3445-
initial property value of <var>target property</var> on
3446-
<var>keyframe</var>, hence we we make this
3447-
<var>V</var><sub>b</sub> in the above step.
3448-
34493427
1. If there is only one keyframe in <var>interval endpoints</var>
34503428
return the property value of <var>target property</var> on that
34513429
keyframe.
@@ -3733,29 +3711,6 @@ property</a> is applied using the following process.
37333711
effect at the top of the <a>effect stack</a> established for the target
37343712
property.
37353713

3736-
<h3 id="effect-accumulation-section">Effect accumulation</h3>
3737-
3738-
Similar to the compositing performed between <a>effect values</a>
3739-
(see [[#effect-composition]]), the <dfn>iteration composite operation</dfn>
3740-
determines how values are combined between successive iterations of
3741-
the same <a>keyframe effect</a>.
3742-
3743-
This specification defines two <a>iteration composite operations</a>
3744-
as follows:
3745-
3746-
: <dfn lt="iteration composite operation replace">replace</dfn>
3747-
:: Each successive iteration is calculated independently of previous
3748-
iterations.
3749-
: <dfn lt="iteration composite operation accumulate">accumulate
3750-
:: Successive iterations of the animation are <a
3751-
lt="value accumulation">accumulated</a> with the
3752-
final value of the previous iteration.
3753-
3754-
The application of the <a>iteration composite operation</a> is
3755-
incorporated in the calculation of the <a>effect value</a> in <a
3756-
href="#the-effect-value-of-a-keyframe-animation-effect"
3757-
section></a>.
3758-
37593714
<h3 id="replacing-animations">Replacing animations</h3>
37603715

37613716
<div class="informative-bg"><em>This section is non-normative</em>
@@ -4689,7 +4644,6 @@ dictionary ComputedEffectTiming : EffectTiming {
46894644
Constructor(KeyframeEffect source)]
46904645
interface KeyframeEffect : AnimationEffect {
46914646
attribute (Element or CSSPseudoElement)? target;
4692-
attribute IterationCompositeOperation iterationComposite;
46934647
attribute CompositeOperation composite;
46944648
sequence&lt;object&gt; getKeyframes();
46954649
void setKeyframes(object? keyframes);
@@ -4724,16 +4678,15 @@ interface KeyframeEffect : AnimationEffect {
47244678
If that procedure causes an exception to be thrown, propagate the
47254679
exception and abort this procedure.
47264680

4727-
1. If <var>options</var> is a {{KeyframeEffectOptions}} object,
4728-
assign the {{KeyframeEffect/iterationComposite}}, and
4729-
{{KeyframeEffect/composite}}, properties of <var>effect</var> to the
4730-
corresponding value from <var>options</var>.
4681+
1. If <var>options</var> is a {{KeyframeEffectOptions}} object, assign
4682+
the {{KeyframeEffect/composite}} property of <var>effect</var> to
4683+
the corresponding value from <var>options</var>.
47314684

4732-
When assigning these properties, the error-handling defined for the
4733-
corresponding setters on the {{KeyframeEffect}} interface is applied.
4734-
If any of those setters require an exception to be thrown
4735-
for the values specified by <var>options</var>, this procedure must
4736-
<a>throw</a> the same exception and abort all further steps.
4685+
When assigning this property, the error-handling defined for the
4686+
corresponding setter on the {{KeyframeEffect}} interface is applied.
4687+
If the setter requires an exception to be thrown for the value
4688+
specified by <var>options</var>, this procedure must <a>throw</a>
4689+
the same exception and abort all further steps.
47374690

47384691
1. Initialize the set of <a>keyframes</a> by performing the procedure
47394692
defined for {{KeyframeEffect/setKeyframes()}} passing
@@ -4777,7 +4730,6 @@ interface KeyframeEffect : AnimationEffect {
47774730

47784731
* <a>target element</a>,
47794732
* <a>keyframes</a>,
4780-
* <a>iteration composite operation</a>,
47814733
* <a>composite operation</a>, and
47824734
* all specified timing properties:
47834735
* [=start delay=],
@@ -4812,14 +4764,6 @@ interface KeyframeEffect : AnimationEffect {
48124764
a specific element such as an animation that produces a sound
48134765
using an audio API.
48144766

4815-
: <dfn attribute for=KeyframeEffect>iterationComposite</dfn>
4816-
:: The <a>iteration composite operation</a> property of this
4817-
<a>keyframe effect</a> as specified by one of the
4818-
<a>IterationCompositeOperation</a> enumeration values.
4819-
4820-
On setting, sets the <a>iteration composite operation</a> property of this
4821-
<a>animation effect</a> to the provided value.
4822-
48234767
: <dfn attribute for=KeyframeEffect>composite</dfn>
48244768
:: The <a>composite operation</a> used to composite this
48254769
<a>keyframe effect</a> with the <a>effect stack</a>, as
@@ -5603,17 +5547,12 @@ options)}} constructor by providing a {{KeyframeEffectOptions}} object.
56035547

56045548
<pre class='idl'>
56055549
dictionary KeyframeEffectOptions : EffectTiming {
5606-
IterationCompositeOperation iterationComposite = "replace";
56075550
CompositeOperation composite = "replace";
56085551
};
56095552
</pre>
56105553

56115554
<div class="members">
56125555

5613-
: <dfn dict-member for=KeyframeEffectOptions>iterationComposite</dfn>
5614-
:: The <a>iteration composite operation</a> used to define the way
5615-
animation values build from iteration to iteration.
5616-
56175556
: <dfn dict-member for=KeyframeEffectOptions>composite</dfn>
56185557
:: The <a>composite operation</a> used to composite this
56195558
animation with the <a>effect stack</a>, as specified by one
@@ -5624,29 +5563,6 @@ dictionary KeyframeEffectOptions : EffectTiming {
56245563

56255564
</div>
56265565

5627-
<h3 id="the-iterationcompositeoperation-enumeration">The <code>IterationCompositeOperation</code> enumeration</h3>
5628-
5629-
The possible values of an <a>animation effect</a>'s
5630-
<a>iteration composite operation</a> are represented by the
5631-
<dfn>IterationCompositeOperation</dfn> enumeration.
5632-
5633-
<pre class='idl'>
5634-
enum IterationCompositeOperation { "replace", "accumulate" };
5635-
</pre>
5636-
5637-
: <code>replace</code>
5638-
:: Corresponds to the <a
5639-
lt="iteration composite operation replace">replace</a>
5640-
<a>iteration composite operation</a> value such that the
5641-
<a>effect value</a> produced is independent of the
5642-
<a>current iteration</a>.
5643-
: <code>accumulate</code>
5644-
:: Corresponds to the <a
5645-
lt="iteration composite operation accumulate">accumulate</a>
5646-
iteration composite operation value such that
5647-
subsequent iterations of an <a>animation effect</a> build
5648-
on the final value of the previous iteration.
5649-
56505566
<h3 id="the-compositeoperation-enumeration">The <code>CompositeOperation</code> and <code>CompositeOperationOrAuto</code> enumerations</h3>
56515567

56525568
The possible values of an <a>keyframe effect</a>'s

web-animations-2/Overview.bs

Lines changed: 149 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
<style>
2+
.constructors::before, .members::before {
3+
font: bold 100% sans-serif;
4+
text-align: left;
5+
margin: 1.33em 0px;
6+
color: #005A9C;
7+
}
8+
9+
.constructors::before { content: 'Constructors' }
10+
</style>
11+
112
<pre class='metadata'>
213
Title: Web Animations Level 2
314
Status: UD
@@ -1229,6 +1240,43 @@ Update the description of an effect that targets a non-animated property as:
12291240
> delaying the fulfilment of an <a>animation</a>'s <a>current finished
12301241
> promise</a>.
12311242

1243+
<h3 id="keyframe-effects">Keyframe Effects</h3>
1244+
1245+
<h4 id="the-effect-value-of-a-keyframe-animation-effect">The effect value of a keyframe effect</h4>
1246+
1247+
The procedure for computing the <a>effect value</a> of a single property
1248+
referenced by a <a>keyframe effect</a> as one of its <a>target properties</a>,
1249+
for a given <var ignore=''>iteration progress</var>, <var>current iteration</var> and
1250+
<var ignore=''>underlying value</var> is amended by inserting the following step
1251+
after the step to apply the keyframe effect composite mode.
1252+
1253+
12. For each <var>keyframe</var> in <var ignore=''>interval endpoints</var>:
1254+
1255+
1. (As in web-animations-1).
1256+
1257+
1. If this <a>keyframe effect</a> has an <a>iteration
1258+
composite operation</a> of <a
1259+
lt="iteration composite operation accumulate">accumulate</a>,
1260+
apply the following step <var>current iteration</var> times:
1261+
1262+
* replace the property value of <var>target property</var>
1263+
on <var>keyframe</var> with the result of combining the
1264+
property value on the final keyframe in <var ignore=''>property-specific
1265+
keyframes</var> (<var>V</var><sub>a</sub>) with the
1266+
property value on <var>keyframe</var>
1267+
(<var>V</var><sub>b</sub>) using the <a
1268+
lt="value accumulation">accumulation procedure</a>
1269+
defined for <var>target property</var>.
1270+
1271+
Note: The order of arguments here is important. In the case where
1272+
the animation type of the target property does not define a
1273+
procedure for accumulation or addition, the default definition
1274+
for these procedures result in <var>V</var><sub>b</sub> being
1275+
returned. When performing iteration composition on propreties
1276+
that do not support accumulation, the result should be the
1277+
initial property value of <var>target property</var> on
1278+
<var>keyframe</var>, hence we we make this
1279+
<var>V</var><sub>b</sub> in the above step.
12321280

12331281
<h3 id="combining-effects">Combining effects</h3>
12341282

@@ -1241,6 +1289,30 @@ The procedure for sorting effects appends the following step:
12411289
> same <a>animation</a> since otherwise the order would have been
12421290
> resolved in the previous step.)
12431291

1292+
<h3 id="effect-accumulation-section">Effect accumulation</h3>
1293+
1294+
Similar to the compositing performed between <a>effect values</a>
1295+
(see [[web-animations-1#effect-composition]]), the <dfn>iteration composite operation</dfn>
1296+
determines how values are combined between successive iterations of
1297+
the same <a>keyframe effect</a>.
1298+
1299+
This specification defines two <a>iteration composite operations</a>
1300+
as follows:
1301+
1302+
: <dfn lt="iteration composite operation replace">replace</dfn>
1303+
:: Each successive iteration is calculated independently of previous
1304+
iterations.
1305+
: <dfn lt="iteration composite operation accumulate">accumulate
1306+
:: Successive iterations of the animation are <a
1307+
lt="value accumulation">accumulated</a> with the
1308+
final value of the previous iteration.
1309+
1310+
The application of the <a>iteration composite operation</a> is
1311+
incorporated in the calculation of the <a>effect value</a> in <a
1312+
href="#the-effect-value-of-a-keyframe-animation-effect"
1313+
section></a>.
1314+
1315+
12441316
<h3 id="custom-effects">Custom effects</h3>
12451317
12461318
(This section is added.)
@@ -2043,12 +2115,48 @@ SequenceEffect implements GroupEffectMutable;
20432115
<h3 id="the-keyframeeffect-interfaces">The <code>KeyframeEffectReadOnly</code>
20442116
and <code>KeyframeEffect</code> interfaces</h3>
20452117

2046-
Add:
2118+
The <a>KeyframeEffect</a> interface is modified to add the following:
20472119

20482120
<pre class='idl'>
2121+
partial interface KeyframeEffect {
2122+
attribute IterationCompositeOperation iterationComposite;
2123+
};
2124+
20492125
KeyframeEffect implements AnimationEffectMutable;
20502126
</pre>
20512127

2128+
<div class="constructors">
2129+
2130+
: <dfn constructor for=KeyframeEffect
2131+
lt="KeyframeEffect(target, keyframes, options)">
2132+
KeyframeEffect (target, keyframes, options)</dfn>
2133+
:: Amend step 5 of the procedure to create a new <a>KeyframeEffect</a> object as follows:
2134+
2135+
5. If <var>options</var> is a {{KeyframeEffectOptions}} object,
2136+
assign the {{KeyframeEffect/iterationComposite}}, and
2137+
{{KeyframeEffect/composite}}, properties of <var>effect</var> to the
2138+
corresponding value from <var>options</var>.
2139+
2140+
When assigning these properties, the error-handling defined for the
2141+
corresponding setters on the {{KeyframeEffect}} interface is applied.
2142+
If any of those setters require an exception to be thrown
2143+
for the values specified by <var>options</var>, this procedure must
2144+
<a>throw</a> the same exception and abort all further steps.
2145+
2146+
: <dfn constructor for=KeyframeEffect lt="KeyframeEffect(source)">KeyframeEffect (source)</dfn>
2147+
:: Amend the procedure to create a new {{KeyframeEffect}} object with the
2148+
same properties as {{KeyframeEffect/KeyframeEffect(source)/source}} to include setting the
2149+
<a>iteration composite operation</a> from <var>source</var> on <var>effect</var>.
2150+
2151+
<div class="attributes">
2152+
: <dfn attribute for=KeyframeEffect>iterationComposite</dfn>
2153+
:: The <a>iteration composite operation</a> property of this
2154+
<a>keyframe effect</a> as specified by one of the
2155+
<a>IterationCompositeOperation</a> enumeration values.
2156+
2157+
On setting, sets the <a>iteration composite operation</a> property of this
2158+
<a>animation effect</a> to the provided value.
2159+
20522160
<h4 id="creating-a-new-keyframeeffect-object">Creating a new <code>KeyframeEffect</code> object</h4>
20532161

20542162
<div class='informative-bg'><em>This section is non-normative</em>
@@ -2078,6 +2186,46 @@ new SequenceEffect(
20782186

20792187
</div>
20802188

2189+
<h4 id="the-keyframeeffectoptions-dictionary">The KeyframeEffectOptions dictionary</h4>
2190+
2191+
The <a>KeyframeEffectOptions</a> dictionary interface is modified to add the
2192+
following member:
2193+
2194+
<pre class='idl'>
2195+
partial dictionary KeyframeEffectOptions {
2196+
IterationCompositeOperation iterationComposite = "replace";
2197+
};
2198+
</pre>
2199+
2200+
<div class="members">
2201+
2202+
: <dfn dict-member for=KeyframeEffectOptions>iterationComposite</dfn>
2203+
:: The <a>iteration composite operation</a> used to define the way
2204+
animation values build from iteration to iteration.
2205+
2206+
<h3 id="the-iterationcompositeoperation-enumeration">The IterationCompositeOperation enumeration</h3>
2207+
2208+
The possible values of an <a>animation effect</a>'s
2209+
<a>iteration composite operation</a> are represented by the
2210+
<dfn>IterationCompositeOperation</dfn> enumeration.
2211+
2212+
<pre class='idl'>
2213+
enum IterationCompositeOperation { "replace", "accumulate" };
2214+
</pre>
2215+
2216+
: <code>replace</code>
2217+
:: Corresponds to the <a
2218+
lt="iteration composite operation replace">replace</a>
2219+
<a>iteration composite operation</a> value such that the
2220+
<a>effect value</a> produced is independent of the
2221+
<a>current iteration</a>.
2222+
: <code>accumulate</code>
2223+
:: Corresponds to the <a
2224+
lt="iteration composite operation accumulate">accumulate</a>
2225+
iteration composite operation value such that
2226+
subsequent iterations of an <a>animation effect</a> build
2227+
on the final value of the previous iteration.
2228+
20812229
<h3 id="the-effectcallback-callback-function">The <code>EffectCallback</code> callback function</h3>
20822230

20832231
<a>Custom effects</a> can be defined in script by providing an

0 commit comments

Comments
 (0)