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
Copy file name to clipboardExpand all lines: css-transforms-2/Overview.bs
+49Lines changed: 49 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1267,6 +1267,55 @@ The transform functions <<matrix()>>, ''matrix3d()'' and ''perspective()'' get c
1267
1267
1268
1268
For interpolations with the primitive ''rotate3d()'', the direction vectors of the transform functions get normalized first. If the normalized vectors are not equal and both rotation angles are non-zero the transform functions get converted into 4x4 matrices first and interpolated as defined in section <a href="#matrix-interpolation">Interpolation of Matrices</a> afterwards. Otherwise the rotation angle gets interpolated numerically and the rotation vector of the non-zero angle is used or (0, 0, 1) if both angles are zero.
1269
1269
1270
+
<div class="example">
1271
+
1272
+
The two transform functions ''translate(0)'' and ''translate(100px)'' are of the same type, have the same number of arguments and therefore can get interpolated numerically. ''translateX(100px)'' is not of the same type and ''translate(100px, 0)'' does not have the same number of arguments, therefore these transform functions can not get interpolated without a former conversion step.
1273
+
1274
+
</div>
1275
+
1276
+
Two different types of transform functions that share the same primitive, or transform functions of the same type with different number of arguments can be interpolated. Both transform functions need a former conversion to the common primitive first and get interpolated numerically afterwards. The computed value will be the primitive with the resulting interpolated arguments.
1277
+
1278
+
<div class="example">
1279
+
1280
+
The following example describes a transition from ''translateX(100px)'' to ''translateY(100px)'' in 3 seconds on hovering over the div box. Both transform functions derive from the same primitive ''translate()''
1281
+
and therefore can be interpolated.
1282
+
1283
+
<pre><code highlight=css>
1284
+
div {
1285
+
transform: translateX(100px);
1286
+
}
1287
+
1288
+
div:hover {
1289
+
transform: translateY(100px);
1290
+
transition: transform 3s;
1291
+
}
1292
+
</code></pre>
1293
+
1294
+
For the time of the transition both transform functions get transformed to the common primitive. ''translateX(100px)'' gets converted to ''translate(100px, 0)'' and ''translateY(100px)'' gets converted to ''translate(0, 100px)''. Both transform functions can then get interpolated numerically.
1295
+
</div>
1296
+
1297
+
If both transform functions share a primitive in the two-dimensional space, both transform functions get converted to the two-dimensional primitive. If one or both transform functions are three-dimensional transform functions, the common three-dimensional primitive is used.
1298
+
1299
+
<div class="example">
1300
+
1301
+
In this example a two-dimensional transform function gets animated to a three-dimensional transform function. The common primitive is ''translate3d()''.
1302
+
1303
+
<pre><code highlight=css>
1304
+
div {
1305
+
transform: translateX(100px);
1306
+
}
1307
+
1308
+
div:hover {
1309
+
transform: translateZ(100px);
1310
+
transition: transform 3s;
1311
+
}
1312
+
</code></pre>
1313
+
1314
+
First ''translateX(100px)'' gets converted to ''translate3d(100px, 0, 0)'' and ''translateZ(100px)'' to ''translate3d(0, 0, 100px)'' respectively. Then both converted transform functions get interpolated numerically.
1315
+
1316
+
</div>
1317
+
1318
+
1270
1319
Addition and accumulation of transform lists {#combining-transform-lists}
0 commit comments