You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When animating or transitioning transforms, the transform function lists must be interpolated. For interpolation between one transform <em>from-transform</em> and a second transforms <em>to-transform</em>, the rules described below are applied.
1095
+
[=Interpolation=] of transform function lists is performed as follows:
1096
1096
1097
1097
<ul>
1098
-
<li id="none-none-animation">
1099
-
If both the <em>from-</em> and <em>to-transform</em> are ''transform/none'':
1100
-
* There is no interpolation necessary. The computed value stays ''transform/none''.
1101
-
1102
-
<li id="none-transform-animation">
1103
-
If one of the <em>from-</em> or <em>to-transforms</em> is ''transform/none'':
1104
-
* The value ''transform/none'' is replaced by an equivalent [=identity transform function=] list for the corresponding transform function list. Both transform function lists get interpolated following the next rule.
1105
-
1106
-
<div class="example">
1107
-
For example, if <em>from-transform</em> is ''scale(2)'' and <em>to-transform</em> is ''transform/none'' then the value ''scale(1)'' will be used for <em>to-transform</em> and animation will proceed using the next rule. Similarly, if <em>from-transform</em> is ''transform/none'' and <em>to-transform</em> is ''scale(2) rotate(50deg)'' then the animation will execute as if <em>from-transform</em> is ''scale(1) rotate(0)''.
1108
-
1098
+
<li id=none-none-interpolation>
1099
+
If both <var>V<sub>a</sub></var> and <var>V<sub>b</sub></var>
1100
+
are ''transform/none'':
1101
+
* <var>V<sub>result</sub></var> is ''transform/none''.
1102
+
1103
+
<li id=transform-interpolation-length-fixup>
1104
+
Treating ''transform/none'' as a list of zero length,
1105
+
if <var>V<sub>a</sub></var> or <var>V<sub>b</sub></var> differ in length:
1106
+
* extend the shorter list to the length of the longer list,
1107
+
setting the function at each additional position
1108
+
to the [=identity transform function=] matching
1109
+
the function at the corresponding position in the longer list.
1110
+
Both transform function lists are then interpolated
1111
+
following the next rule.
1112
+
1113
+
<div class=example>
1114
+
For example, if <var>V<sub>a</sub></var> is ''scale(2)''
1115
+
and <var>V<sub>b</sub></var> is ''transform/none''
1116
+
then the value ''scale(1)'' will be used for <var>V<sub>b</sub></var>
1117
+
and interpolation will proceed using the next rule.
1118
+
Similarly, if <var>V<sub>a</sub></var> is ''scale(1)''
1119
+
and <var>V<sub>b</sub></var> is ''scale(2) rotate(50deg)''
1120
+
then the interpolation will be performed as if
1121
+
<var>V<sub>a</sub></var> were ''scale(1) rotate(0)''.
1109
1122
</div>
1110
1123
1111
-
<li id="transform-transform-animation">
1112
-
If <em>from-</em> and <em>to-transform</em> have the same number of transform functions, each transform function pair has either the same name, or is a derivative of the same <a href="#transform-primitives">primitive</a>:
1113
-
* Interpolate each transform function pair as described in <a href="#interpolation-of-transform-functions">Interpolation of transform functions</a>. The computed value is the resulting transform function list.
1114
-
1115
-
<div class="example">
1116
-
For example, if <em>from-transform</em> is ''scale(1) translate(0)'' and <em>to-transform</em> is ''translate(100px) scale(2)'' then ''scale(1)'' and ''translate(100px)'' as well as ''translate(0)'' and ''scale(2)'' don't share a common primitive and therefore can not get interpolated following this rule.
1117
-
1124
+
<li>
1125
+
Let <var>V<sub>result</sub></var> be an empty list.
1126
+
Beginning at the start of
1127
+
<var>V<sub>a</sub></var> and <var>V<sub>b</sub></var>,
1128
+
compare the corresponding functions at each position:
If <em>from-</em> and <em>to-transform</em> have a different number of transform functions, and the functions of the shorter transform list have either the same name, or are derivatives of the same <a href="#transform-primitives">primitive</a> of the function at the equivalent position in the longer list:
1122
-
* Extend the shorter list to the length of the longer list, setting the function at each additional position to the [=identity transform function=] matching the function at the equivalent position in the longer list.
1123
-
1124
-
* Interpolate each transform function pair as described in <a href="#interpolation-of-transform-functions">Interpolation of transform functions</a>. The computed value is the resulting transform function list.
1125
-
1126
-
<div class="example">
1127
-
For example, if <em>from-transform</em> is ''scale(1.5)'' and <em>to-transform</em> is ''scale(1.5) rotate(720deg)'', it interpolates as if the <em>from-transform</em> were specified as ''scale(1.5) rotate(0deg)''.
1128
-
</div>
1129
-
1130
-
<li id="other-animation">
1131
-
In all other cases:
1132
-
* The transform functions of each transform function list on the <em>from-</em> and <em>to-transform</em> get <a>post-multiplied</a> and converted into 4x4 matrices. Each of the matrices gets interpolated following the instructions in <a href="#matrix-interpolation">Interpolation of matrices</a>. The computed value is the transform function <<matrix()>>.
1133
-
1134
1165
</ul>
1135
1166
1136
1167
In some cases, an animation might cause a transformation matrix to be singular or non-invertible. For example, an animation in which scale moves from 1 to -1. At the time when the matrix is in such a state, the transformed element is not rendered.
@@ -1502,7 +1533,8 @@ The following changes were made since the <a href="https://www.w3.org/TR/2017/WD
1502
1533
* Clarify behavior of 'transform' on overflow area.
1503
1534
* Remove ''translateX(0)'', ''translateY(0)'', ''scaleX(0)'', ''scaleY(0)'' from the list of neutral elements.
1504
1535
* Remove any reference of 3D transformations of transform function definitions.
1505
-
* Allow interpolation between some <<transform-list>>s with different length.
1536
+
* Specify interpolation between <<transform-list>>s to match lengths and
1537
+
avoid matrix interpolation for the common prefix of the two lists.
1506
1538
* No 'transform' on non-replaced inline boxes, table-column boxes, and table-column-group boxes.
1507
1539
* Define target coordinate space for transformations on <{pattern}>, <{linearGradient}>, <{radialGradient}> and <{clipPath}> elements.
1508
1540
* Remove 3-value <<rotate()>> from transform function primitives.
0 commit comments