Skip to content

Commit 6716ed4

Browse files
committed
[css-transforms-2] Add definitions for transform list addition and accumulation
1 parent e70525c commit 6716ed4

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

css-transforms-2/Overview.bs

+71
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ spec:css-transforms-1;
3434
text: <transform-list>
3535
type: function;
3636
text: matrix()
37+
spec: infra
38+
type:dfn;
39+
text: list
3740
spec: filter-effects-1; type:property; text:filter;
3841
spec: html; type: element; text: a;
3942
</pre>
@@ -1106,6 +1109,74 @@ The transform functions <<matrix()>>, ''matrix3d()'' and ''perspective()'' get c
11061109

11071110
For interpolations with the primitive ''rotate3d()'', the direction vectors of the transform functions get normalized first. If the normalized vectors are equal, the rotation angle gets interpolated numerically. Otherwise the transform functions get converted into 4x4 matrices first and interpolated as defined in section <a href="#matrix-interpolation">Interpolation of Matrices</a> afterwards.
11081111

1112+
Addition and accumulation of transform lists {#combining-transform-lists}
1113+
============================================
1114+
1115+
<div algorithm="transform list addition">
1116+
<a lt="value addition">Addition</a> of two transform lists
1117+
<var>V<sub>a</sub></var> and <var>V<sub>b</sub></var>
1118+
is defined as [=list=] concatenation
1119+
such that <var ignore>V<sub>result</sub></var> is equal to
1120+
<var>V<sub>b</sub></var> [=list/appended=] to
1121+
<var>V<sub>a</sub></var>.
1122+
</div>
1123+
1124+
<div algorithm="transform list accumulation">
1125+
<a lt="value accumulation">Accumulation</a> of two transform lists
1126+
<var>V<sub>a</sub></var> and <var>V<sub>b</sub></var>
1127+
follows the same steps as interpolation
1128+
with regards to matching transform functions including
1129+
padding lists with <a>identity transform functions</a>,
1130+
converting ''transform/none'' to an <a>identity transform function</a>,
1131+
and converting both arguments to matrices as necessary (see
1132+
[[css-transforms-1#interpolation-of-transforms]]).
1133+
However, instead of interpolating the individual parameters,
1134+
they are combined using arithmetic addition--
1135+
except in the case of parameters whose value is one in the
1136+
<a>identity transform function</a>
1137+
(e.g. scale parameters and matrix elements
1138+
<var ignore>m11</var>, <var ignore>m22</var>,
1139+
<var ignore>m33</var>, and <var ignore>m44</var>),
1140+
which combine using <dfn export>accumulation for one-based values</dfn>
1141+
as follows:
1142+
1143+
<var ignore>V<sub>result</sub></var> =
1144+
<var>V<sub>a</sub></var> + <var>V<sub>b</sub></var> - 1
1145+
1146+
<div class="note">
1147+
The above definition preserves the intent of <a lt="value
1148+
accumulation">accumulation</a> which is that
1149+
<var>V<sub>b</sub></var> acts as
1150+
a delta from <var>V<sub>a</sub></var>
1151+
and allows an animation such as:
1152+
1153+
<pre class="lang-javascript">
1154+
div.animate(
1155+
{ transform: ['scale(1)', 'scale(2)'] },
1156+
{
1157+
duration: 1000,
1158+
easing: 'ease',
1159+
}
1160+
);
1161+
</pre>
1162+
1163+
to produce the expected behavior when extended as follows:
1164+
1165+
<pre class="lang-javascript">
1166+
div.animate(
1167+
{ transform: ['scale(1)', 'scale(2)'] },
1168+
{
1169+
duration: 1000,
1170+
easing: 'ease',
1171+
<strong>iterations: 5,
1172+
iterationComposite: 'accumulate',</strong>
1173+
}
1174+
);
1175+
</pre>
1176+
</div>
1177+
</div>
1178+
1179+
11091180
Mathematical Description of Transform Functions {#mathematical-description}
11101181
===============================================
11111182

0 commit comments

Comments
 (0)