Skip to content

Commit 3281266

Browse files
committed
Resolve #927
Add section describing the interpolation between transform lists with different lengths where the shorter list has functions that match the prefix of the longer list.
1 parent cc26824 commit 3281266

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

css-transforms-1/Overview.bs

+14-6
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ When used in this specification, terms have the meanings assigned in this sectio
143143
:: A matrix that defines the mapping from the [=local coordinate system=] into the [=viewport coordinate system=].
144144

145145
: <dfn>2D matrix</dfn>
146-
:: A 3x2 transformation matrix with 6 items or a 4x4 matrix with 16 items, where the items m<sub>31</sub>, m<sub>32</sub>, m<sub>13</sub>, m<sub>23</sub>, m<sub>43</sub>, m<sub>14</sub>, m<sub>24</sub>, m<sub>34</sub> are equal to ''0'' and m<sub>33</sub>, m<sub>44</sub> are equal to ''1''.
146+
:: A 3x2 transformation matrix, or a 4x4 matrix where the items m<sub>31</sub>, m<sub>32</sub>, m<sub>13</sub>, m<sub>23</sub>, m<sub>43</sub>, m<sub>14</sub>, m<sub>24</sub>, m<sub>34</sub> are equal to ''0'' and m<sub>33</sub>, m<sub>44</sub> are equal to ''1''.
147147

148148
: <dfn>identity transform function</dfn>
149149
:: A <a href="#transform-functions">transform function</a> that is equivalent to a identity 4x4 matrix (see <a href="#mathematical-description">Mathematical Description of Transform Functions</a>). Examples for identity transform functions are ''translate(0)'', ''translateX(0)'', ''translateY(0)'', ''scale(1)'', ''scaleX(1)'', ''scaleY(1)'', ''rotate(0)'', ''skew(0, 0)'', ''skewX(0)'', ''skewY(0)'' and ''matrix(1, 0, 0, 1, 0, 0)''.
@@ -733,7 +733,7 @@ When animating or transitioning transforms, the transform function lists must be
733733
* There is no interpolation necessary. The computed value stays ''transform/none''.
734734

735735
<li id="none-transform-animation">
736-
If one of the <em>from-</em> or <em>to-transforms</em> is ''transform/none''.
736+
If one of the <em>from-</em> or <em>to-transforms</em> is ''transform/none'':
737737
* 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.
738738

739739
<div class="example">
@@ -742,24 +742,32 @@ When animating or transitioning transforms, the transform function lists must be
742742
</div>
743743

744744
<li id="transform-transform-animation">
745-
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>.
745+
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>:
746746
* 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.
747747

748748
<div class="example">
749749
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.
750750

751751
</div>
752752

753+
<li id="transform-transform-neutral-extend-animation">
754+
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:
755+
* 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.
756+
757+
* 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.
758+
759+
<div class="example">
760+
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)''.
761+
</div>
762+
753763
<li id="other-animation">
754764
In all other cases:
755-
* The transform functions of each transform function list on the <em>from-</em> and <em>to-transform</em> get post multiplied 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'' if both initial matrices can be represented by a correlating 3x2 matrix and ''matrix3d'' otherwise.
765+
* The transform functions of each transform function list on the <em>from-</em> and <em>to-transform</em> get post multiplied 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''.
756766

757767
</ul>
758768

759769
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.
760770

761-
Issue(w3c/csswg-drafts#927): Use proposed tranform interpolation from GitHub issue.
762-
763771

764772
Interpolation of primitives and derived transform functions {#interpolation-of-transform-functions}
765773
===================================================================================================

0 commit comments

Comments
 (0)