transform-function

  • Revision slug: CSS/transform-function
  • Revision title: transform-function
  • Revision id: 39868
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

{{ draft() }}

The <transform-function> CSS data type denotes a function to apply to an element's representation in order to modify it. Usually such transform may be expressed by matrices and the resulting images can be determined using matrix multiplication on each point.

Coordinates for 2D graphics

There are several coordinates model used when describing transformation. The most usual are the Cartesian coordinates and the homogenous coordinates.

Cartesian coordinatescoord_in_R2.png

In Cartesian coordinates each point of the Euclidian space is described using two values, the abscissa and the ordinate. The origin, the (0, 0)  is the top-left corner of the element. Unlike the usual geometric convention, and like most case in computer graphics, the y-axis goes to the bottom. Each point is mathematically described using the vector notation (x,y).

Each linear function is described using a 2x2 matrix like:

transform-function_matrix_2x2.png.

Applying the transformation consists in doing, for each point, the matrix multiplication between both:

transform_functions_generic_transformation_cart.png.

It is possible to apply several transformation in a raw:

transform_functions_transform_composition_cart.png.

With this notation, it is possible to describe, and therefore composite, most usual transformations: rotations, scaling or skewing. In fact all transformations that are linear functions can be describes. One major transformations is not linear and therefore must be special-cased when using this notation: translation. The translation vector (tx, ty) must be expressed separately, as two more parameters.

Möbius' homogenous coordinates in projective geometry

leading to 3x3 transformation matrices, though more complex and unusual for non-specialist, doesn't suffer from the translation limitation as these can be expressed as linear functions in this algebra, removing the need of special cases

Coordinates for 3D graphics

 

Functions defining transformations

matrix()

matrix(a, b, c, d, tx, ty)

Specifies a 2D transformation matrix comprised of the specified six values. This is the equivalent to applying the transformation matrix [a b c d tx ty].

Note: Gecko (Firefox) accepts a {{ xref_csslength() }} value for tx and ty.
Webkit (Safari, Chrome) and Opera currently support a unitless {{ xref_cssnumber() }} for tx and ty.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
transform-function_matrix_2x2.png transform_function_generic_2D_homo.png    
[a b c d tx ty]  

rotate()

transform-functions-rotate_19.5.pngThe rotate() CSS function defines a transformation that moves the element around a fixed point (as specified by the {{ Cssxref("transform-origin") }} property) without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise. A rotation by 180° is called point reflection.

Syntax

rotate(a)

where :

a
Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
transform_functions_rotation_cart.png transform_functions_rotation_homo.png    
[cos(a) -sin(a) sin(a) cos(a) 0 0]  

rotate3d()

The rotate3d()CSS function defines a transformation that moves the element around a fixed axe without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise.

In the 3D space, rotations have three degrees of liberty, describing an axis of rotation. The axis of rotation is defined by a [x, y, z] vector and pass by the origin (as defined by the {{ cssxref("transform-origin") }} CSS property. If the vector is not normalized, that is the sum of the square of its three coordinates is not 1, it will be normalized internally. A non-normalizable vector, like the null vector, [0, 0, 0], will cause the rotation not to be applied, without invaliding the whole CSS property.

In opposition to rotations in the plane, the composition of 3D rotations is usually not commutative, it means that the order in which the rotations are applied is crucial.

Syntax

rotate3d(x, y, z, a)

where :

x
Is a {{ xref_cssnumber() }} describing the x-coordinate of the vector denoting the axis of rotation.
y
Is a {{ xref_cssnumber() }} describing the y-coordinate of the vector denoting the axis of rotation.
z
Is a {{ xref_cssnumber() }} describing the z-coordinate of the vector denoting the axis of rotation.
a
Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
This is transform in the 3D space and cannot be represented on the plan.    
[]

rotateX()

The rotateX()CSS function defines a transformation that moves the element around the abscissa without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise.

The axis of rotation passes by the origin, defined by {{ cssxref("transform-origin") }} CSS property.

rotateX(a)is a shorthand for rotate3D(1, 0, 0, a).

In opposition to rotations in the plane, the composition of 3D rotations is usually not commutative, it means that the order in which the rotations are applied is crucial.

Syntax

rotateX(a)

where :

a
Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
This is transform in the 3D space and cannot be represented on the plan.    
[]

rotateY()

The rotateY()CSS function defines a transformation that moves the element around the ordinate without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise.

The axis of rotation passes by the origin, defined by {{ cssxref("transform-origin") }} CSS property.

rotateY(a)is a shorthand for rotate3D(0, 1, 0, a).

In opposition to rotations in the plane, the composition of 3D rotations is usually not commutative, it means that the order in which the rotations are applied is crucial.

Syntax

rotateY(a)

where :

a
Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
This is transform in the 3D space and cannot be represented on the plan.    
[]

rotateZ()

The rotateZ()CSS function defines a transformation that moves the element around the z-axis without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise.

The axis of rotation passes by the origin, defined by {{ cssxref("transform-origin") }} CSS property.

rotateZ(a)is a shorthand for rotate3D(0, 0, 1, a).

In opposition to rotations in the plane, the composition of 3D rotations is usually not commutative, it means that the order in which the rotations are applied is crucial.

Syntax

rotateZ(a)

where :

a
Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
This is transform in the 3D space and cannot be represented on the plan.    
[]

scale()

transform-functions-scale_2_2.png

The scale() CSS function modify the size of the element. It can either augment or decrease its size and as the amount of scaling is defined by a vector, if can do so more in one direction than in another one.

This transformation is characterized by a vector whose coordinates define how much scaling is done in each direction. If both coordinates of the vector are equals, the scaling is uniform, or isotropic, and the shape of the element is preserved. In that case, the scaling function defines an homothetic transformation.

When outside the ]-1, 1[ range, the scaling enlarges the element in the direction of the coordinate; when inside the range, it shrinks the element in that direction. When equals to 1 it does nothing and when negative it performs a point reflection and the size modification.

The scale() function only applies the transformation in the Euclidian plane (in 2D). To scale in the space, the scale3D() function has to be used.

Syntax

scale(sx) or
scale(sx, sy)

where :

sx
Is a {{ xref_cssnumber() }} representing the abscissa of the scaling vector.
sy
Is a {{ xref_cssnumber() }} representing the ordinate of the scaling vector. If not present, its default value is sx, leading to a uniform scaling preserving the shape of the element.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
transform_functions_scale_cart.png transform_functions_scale_homo.png transform_functions_scale_homo.png  
[sx 0 0 sy 0 0]  

scale3d()

The scale3d() CSS function modify the size of the element. It can either augment or decrease its size and as the amount of scaling is defined by a vector, if can do so more in one direction than in another one.

This transformation is characterized by a vector whose coordinates define how much scaling is done in each direction. If all three coordinates of the vector are equals, the scaling is uniform, or isotropic, and the shape of the element is preserved. In that case, the scaling function defines an homothetic transformation.

When outside the ]-1, 1[ range, the scaling enlarges the element in the direction of the coordinate; when inside the range, it shrinks the element in that direction. When equals to 1 it does nothing and when negative it performs a point reflection and the size modification.

Syntax

scale3d(sx, sy, sz)

where :

sx
Is a {{ xref_cssnumber() }} representing the abscissa of the scaling vector.
sy
Is a {{ xref_cssnumber() }} representing the ordinate of the scaling vector.
sz
Is a {{ xref_cssnumber() }} representing the z-component of the scaling vector.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
This is transform in the 3D space and cannot be represented on the plan.    
[]

scaleX()

transform-functions-scaleX_2.pngThe scaleX() CSS function modify the abscissa of each element point by a constant factor. Except if this scale factor is 1, in which case the function is the identity transform, the scaling is not isotropic and the angles of the element are not conserved.

scaleX(sx) is a shorthand for scale(sx, 1) or for scale3d(sx, 1, 1).

scaleX(-1) defines an axial symmetry with a vertical axis passing by the origin (as specified by the transform-origin property).

Syntax

scaleX(s)

where :

s
Is a {{ xref_cssnumber() }} representing the scaling factor to apply on the abscissa of each point of the element.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
transform_functions_scaleX_homo.png transform_functions_scaleX_cart.png transform_functions_scaleX_cart.png  
[s 0 0 1 0 0]  

scaleY()

transform-functions-scaleY_2.png

The scaleY() CSS function modify the ordinate of each element point by a constant factor. Except if this scale factor is 1, in which case the function is the identity transform, the scaling is not isotropic and the angles of the element are not conserved.

scaleY(sy) is a shorthand for scale(1, sy) or for scale3d(1, sy, 1).

scaleY(-1) defines an axial symmetry with an horizontal axis passing by the origin (as specified by the transform-origin property).

Syntax

scaleY(s)

where :

s
Is a {{ xref_cssnumber() }} representing the scaling factor to apply on the ordinate of each point of the element.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
transform_functions_scaleY_cart.png transform_functions_scaleY_homo.png transform_functions_scaleY_homo.png  
[1 0 0 s 0 0]  

scaleZ()

The scaleZ() CSS function modify the z-coordinate of each element point by a constant factor. Except if this scale factor is 1, in which case the function is the identity transform, the scaling is not isotropic and the angles of the element are not conserved.

scaleZ(sz) is a shorthand for scale3d(1, 1, sz).

scaleZ(-1) defines an axial symmetry along the z-axis passing by the origin (as specified by the transform-origin property).

Syntax

scaleZ(s)

where :

s
Is a {{ xref_cssnumber() }} representing the scaling factor to apply on the z-coordinate of each point of the element.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
This is transform in the 3D space and cannot be represented on the plan.    
[1 0 0 s 0 0]

skew()

The skew() CSS function is a shear mapping, or transvection, distorting each point of an element by a certain angle in each direction. It is done by increasing each coordinate by a value proportionate to the specified angle and to the distance to the origin. The more far from the origin, the more away the point is, the greater will be the value added to it.

Syntax

skew(ax)       or
skew(ax, ay)

where :

ax
Is an {{ xref_cssangle() }} representing the angle to use to distort the element along the abscissa.
ay
Is an {{ xref_cssangle() }} representing the angle to use to distort the element along the ordinate.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
       
[1 tan(ay) tan(ax) 1 0 0]  

skewX()

The skewX() CSS function is an horizontal shear mapping distorting each point of an element by a certain angle in the horizontal direction. It is done by increasing the abscissa coordinate by a value proportionate to the specified angle and to the distance to the origin. The more far from the origin, the more away the point is, the greater will be the value added to it.

Syntax

skewX(a)

where :

a
Is an {{ xref_cssangle() }} representing the angle to use to distort the element along the abscissa.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
       
[1 0 tan(a) 1 0 0]  

skewY()

The skewY() CSS function is an vertical shear mapping distorting each point of an element by a certain angle in the vertical direction. It is done by increasing the ordinate coordinate by a value proportionate to the specified angle and to the distance to the origin. The more far from the origin, the more away the point is, the greater will be the value added to it.

Syntax

skewX(a)

where :

a
Is an {{ xref_cssangle() }} representing the angle to use to distort the element along the ordinate.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
       
[1 tan(a) 0 1 0 0]  

skewY()

skewY(angle)

Skews the element around the Y axis by the given angle.

translate()

transform-functions-translate_2.pngThe translate() CSS function moves the position of the element on the plane. This transformation is characterized by a vector whose coordinates define how much it moves in each direction.

Syntax

translate(tx)       or
translate(tx, ty)

where :

tx
Is a {{ xref_csslength() }} representing the abscissa of the translating vector.
ty
Is a {{ xref_csslength() }} representing the ordinate of the translating vector. If missing, it is assumed to be equals to txtranslate(2) means translate(2, 2).
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3

A translation is not a linear transform in ℝ2 and cannot be represented using a matrix in the cartesian coordinates system.

transform_functions_translate_homo.png transform_functions_translate_homo.png  
[1 0 0 1 tx ty]  

translate3d()

The translate3d() CSS function moves the position of the element in the 3D space. This transformation is characterized by a 3-dimension vector whose coordinates define how much it moves in each direction.

Syntax

translate3d(tx, ty, tz)

where :

tx
Is a {{ xref_csslength() }} representing the abscissa of the translating vector.
ty
Is a {{ xref_csslength() }} representing the ordinate of the translating vector.
tz
Is a {{ xref_csslength() }} representing the z component of the translating vector. It can't be a {{ xref_csspercentage() }} value; in that case the property containing the transform is considered invalid.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3

This is transform in the 3D space and cannot be represented on the plan.

A translation is not a linear transform in ℝ3 and cannot be represented using a matrix in the Cartesian coordinates system.  
[]

translateX()

transform-functions-translateX_2.pngThe translateX() CSS function moves horizontally the element on the plane. This transformation is characterized by a {{ xref_csslength() }} defining how much it moves horizontally.

translateX(tx) is a shortcut for translate(tx, 0).

Syntax

translateX(t)

where :

t
Is a {{ xref_csslength() }} representing the abscissa of the translating vector.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3

A translation is not a linear transform in ℝ2 and cannot be represented using a matrix in the cartesian coordinates system.

transform_functions_translateX_homo.png transform_functions_translateX_homo.png  
[1 0 0 1 t 0]  

translateY()

transform-functions-translateY_2.pngThe translateY() CSS function moves vertically the element on the plane. This transformation is characterized by a {{ xref_csslength() }} defining how much it moves vertically.

translateY(ty) is a shortcut for translate(0, ty).

Syntax

translateY(t)

where :

t
Is a {{ xref_csslength() }} representing the z-component of the translating vector. It can't be a {{ xref_csspercentage() }} value; in that case the property containing the transform is considered invalid.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3

A translation is not a linear transform in ℝ2 and cannot be represented using a matrix in the cartesian coordinates system.

transform_functions_translateY_homo.png transform_functions_translateY_homo.png  
[1 0 0 1 0 t]  

translateZ()

The translateZ() CSS function moves the element along the z-axis of the 3D space. This transformation is characterized by a {{ xref_csslength() }} defining how much it moves.

translateZ(tz) is a shorthand for translate3d(0, 0, tz).

Syntax

translateZ(t)

where :

t
Is a {{ xref_csslength() }} representing the ordinate of the translating vector.
Cartesian coordinates on ℝ2 Homogenous coordinates on ℝℙ2 Cartesian coordinates on ℝ3 Homogenous coordinates on ℝℙ3
This is transform in the 3D space and cannot be represented on the plan. A translation is not a linear transform in ℝ3 and cannot be represented using a matrix in the Cartesian coordinates system.  
[]

Revision Source

<p>{{ draft() }}</p>
<p>The <code>&lt;transform-function&gt;</code> CSS data type denotes a function to apply to an element's representation in order to modify it. Usually such transform may be expressed by matrices and the resulting images can be determined using matrix multiplication on each point.</p>
<h2>Coordinates for 2D graphics</h2>
<p>There are several coordinates model used when describing transformation. The most usual are the Cartesian coordinates and the homogenous coordinates.</p>
<h3><span class="external">Cartesian coordinates</span><a href="/@api/deki/files/5796/=coord_in_R2.png" title="coord_in_R2.png"><img align="right" alt="coord_in_R2.png" class="internal rwrap" src="/@api/deki/files/5796/=coord_in_R2.png?size=thumb" style="width: 149px; height: 160px;"></a></h3>
<p>In <a class="external" href="http://en.wikipedia.org/wiki/Cartesian_coordinate_system" title="http://en.wikipedia.org/wiki/Cartesian_coordinate_system">Cartesian coordinates</a> each point of the <a class="external" href="http://en.wikipedia.org/wiki/Euclidean_geometry" title="http://en.wikipedia.org/wiki/Euclidean_geometry">Euclidian space</a> is described using two values, the abscissa and the ordinate. The origin, the <code>(0, 0)</code>  is the top-left corner of the element. Unlike the usual geometric convention, and like most case in computer graphics, the y-axis goes to the bottom. Each point is mathematically described using the vector notation <code>(x,y)</code>.</p>
<p>Each linear function is described using a 2x2 matrix like:</p>
<div style="text-align: center;"><img alt="transform-function_matrix_2x2.png" class="internal default" src="/@api/deki/files/5798/=transform-function_matrix_2x2.png">.</div>
<p>Applying the transformation consists in doing, for each point, the matrix multiplication between both:</p>
<div style="text-align: center;"><img alt="transform_functions_generic_transformation_cart.png" class="internal default" src="/@api/deki/files/5799/=transform_functions_generic_transformation_cart.png">.</div>
<p>It is possible to apply several transformation in a raw:</p>
<div style="text-align: center;"><img alt="transform_functions_transform_composition_cart.png" class="internal default" src="/@api/deki/files/5800/=transform_functions_transform_composition_cart.png" style="">.</div>
<p>With this notation, it is possible to describe, and therefore composite, most usual transformations: rotations, scaling or skewing. In fact all transformations that are linear functions can be describes. One major transformations is not linear and therefore must be special-cased when using this notation: translation. The translation vector (tx, ty) must be expressed separately, as two more parameters.</p>
<h3><a class="external" href="http://en.wikipedia.org/wiki/August_Ferdinand_M%C3%B6bius" title="http://en.wikipedia.org/wiki/August_Ferdinand_M%C3%B6bius">Möbius</a>' <a class="external" href="http://en.wikipedia.org/wiki/Homogeneous_coordinates" title="http://en.wikipedia.org/wiki/Homogeneous_coordinates">homogenous coordinates</a> in <a class="external" href="http://en.wikipedia.org/wiki/Projective_geometry" title="http://en.wikipedia.org/wiki/Projective_geometry">projective geometry</a></h3>
<p>leading to 3x3 transformation matrices, though more complex and unusual for non-specialist, doesn't suffer from the translation limitation as these can be expressed as linear functions in this algebra, removing the need of special cases</p>
<h2>Coordinates for 3D graphics</h2>
<p> </p>
<h2>Functions defining transformations</h2>
<h3><code>matrix()</code></h3>
<pre>matrix(a, b, c, d, tx, ty)
</pre>
<p>Specifies a 2D transformation matrix comprised of the specified six values. This is the equivalent to applying the transformation <strong>matrix [a b c d tx ty]</strong>.</p>
<div class="note"><strong>Note:</strong> Gecko (Firefox) accepts a {{ xref_csslength() }} value for <strong>tx</strong> and <strong>ty</strong>.<br> Webkit (Safari, Chrome) and Opera currently support a unitless {{ xref_cssnumber() }} for <strong>tx</strong> and <strong>ty</strong>.</div>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"><img alt="transform-function_matrix_2x2.png" class="internal default" src="/@api/deki/files/5798/=transform-function_matrix_2x2.png"></td> <td><img alt="transform_function_generic_2D_homo.png" class="internal default" src="/@api/deki/files/5801/=transform_function_generic_2D_homo.png"></td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[a b c d tx ty]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>rotate()</code></h3>
<p><img align="left" alt="transform-functions-rotate_19.5.png" class="internal lwrap" src="/@api/deki/files/5976/=transform-functions-rotate_19.5.png">The <code>rotate()</code> CSS function defines a transformation that moves the element around a fixed point (as specified by the {{ Cssxref("transform-origin") }} property) without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise. A rotation by 180° is called <em>point reflection</em>.</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">rotate(<em>a</em>)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">a</dt> <dd style="margin-left: 40px;">Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"><img alt="transform_functions_rotation_cart.png" class="internal default" src="/@api/deki/files/5802/=transform_functions_rotation_cart.png"></td> <td><img alt="transform_functions_rotation_homo.png" class="internal default" src="/@api/deki/files/5803/=transform_functions_rotation_homo.png"></td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[cos(a) -sin(a) sin(<em>a</em>) cos(<em>a</em>) 0 0]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>rotate3d()</code></h3>
<p>The <code>rotate3d()</code>CSS function defines a transformation that moves the element around a fixed axe without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise.</p>
<p>In the 3D space, rotations have three degrees of liberty, describing an axis of rotation. The axis of rotation is defined by a [x, y, z] vector and pass by the origin (as defined by the {{ cssxref("transform-origin") }} CSS property. If the vector is not <em>normalized</em>, that is the sum of the square of its three coordinates is not 1, it will be normalized internally. A non-normalizable vector, like the null vector, [0, 0, 0], will cause the rotation not to be applied, without invaliding the whole CSS property.</p>
<div class="note">In opposition to rotations in the plane, the composition of 3D rotations is usually not commutative, it means that the order in which the rotations are applied is crucial.</div>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">rotate3d(<em>x</em>, <em>y</em>, <em>z</em>, <em>a</em>)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">x</dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} describing the x-coordinate of the vector denoting the axis of rotation.</dd> <dt style="margin-left: 40px;">y</dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} describing the y-coordinate of the vector denoting the axis of rotation.</dd> <dt style="margin-left: 40px;">z</dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} describing the z-coordinate of the vector denoting the axis of rotation.</dd> <dt style="margin-left: 40px;">a</dt> <dd style="margin-left: 40px;">Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="2" rowspan="2">This is transform in the 3D space and cannot be represented on the plan.</td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[]</code></td> </tr> </tbody>
</table>
<h3><code>rotateX()</code></h3>
<p>The <code>rotateX()</code>CSS function defines a transformation that moves the element around the abscissa without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise.</p>
<p>The axis of rotation passes by the origin, defined by {{ cssxref("transform-origin") }} CSS property.</p>
<p><code>rotateX(a)</code>is a shorthand for <code>rotate3D(1, 0, 0, a)</code>.</p>
<div class="note">In opposition to rotations in the plane, the composition of 3D rotations is usually not commutative, it means that the order in which the rotations are applied is crucial.</div>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">rotateX(<em>a</em>)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">a</dt> <dd style="margin-left: 40px;">Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="2" rowspan="2">This is transform in the 3D space and cannot be represented on the plan.</td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[]</code></td> </tr> </tbody>
</table>
<h3><code>rotateY()</code></h3>
<p>The <code>rotateY()</code>CSS function defines a transformation that moves the element around the ordinate without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise.</p>
<p>The axis of rotation passes by the origin, defined by {{ cssxref("transform-origin") }} CSS property.</p>
<p><code>rotateY(a)</code>is a shorthand for <code>rotate3D(0, 1, 0, a)</code>.</p>
<div class="note">In opposition to rotations in the plane, the composition of 3D rotations is usually not commutative, it means that the order in which the rotations are applied is crucial.</div>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">rotateY(<em>a</em>)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">a</dt> <dd style="margin-left: 40px;">Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="2" rowspan="2">This is transform in the 3D space and cannot be represented on the plan.</td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[]</code></td> </tr> </tbody>
</table>
<h3><code>rotateZ()</code></h3>
<p>The <code>rotateZ()</code>CSS function defines a transformation that moves the element around the z-axis without deforming it. The amount of movement is defined by the specified angle; if positive, the movement will be clockwise, if negative, it will be counter-clockwise.</p>
<p>The axis of rotation passes by the origin, defined by {{ cssxref("transform-origin") }} CSS property.</p>
<p><code>rotateZ(a)</code>is a shorthand for <code>rotate3D(0, 0, 1, a)</code>.</p>
<div class="note">In opposition to rotations in the plane, the composition of 3D rotations is usually not commutative, it means that the order in which the rotations are applied is crucial.</div>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">rotateZ(<em>a</em>)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">a</dt> <dd style="margin-left: 40px;">Is an {{ xref_cssangle() }} representing the angle of the rotation. A positive angle denotes a clockwise rotation, a negative angle a counter-clockwise one.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="2" rowspan="2">This is transform in the 3D space and cannot be represented on the plan.</td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[]</code></td> </tr> </tbody>
</table>
<h3><code>scale()</code></h3>
<p><img align="left" alt="transform-functions-scale_2_2.png" class="internal lwrap" src="/@api/deki/files/5804/=transform-functions-scale_2_2.png?size=webview" style="width: 350px; height: 290px;"></p>
<p>The <code>scale()</code> CSS function modify the size of the element. It can either augment or decrease its size and as the amount of scaling is defined by a vector, if can do so more in one direction than in another one.</p>
<p>This transformation is characterized by a vector whose coordinates define how much scaling is done in each direction. If both coordinates of the vector are equals, the scaling is uniform, or isotropic, and the shape of the element is preserved. In that case, the scaling function defines an homothetic transformation.</p>
<p>When outside the <code>]-1, 1[</code> range, the scaling enlarges the element in the direction of the coordinate; when inside the range, it shrinks the element in that direction. When equals to <code>1</code> it does nothing and when negative it performs a <em>point reflection</em> and the size modification.</p>
<div class="note" style="clear:left;">The <code>scale</code><code>()</code> function only applies the transformation in the Euclidian plane (in 2D). To scale in the space, the <code>scale3D()</code> function has to be used.</div>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">scale(<em>sx</em>) or
scale(<em>sx</em>, <em>sy</em>)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;"><em>sx</em></dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} representing the abscissa of the scaling vector.</dd> <dt style="margin-left: 40px;"><em>sy</em></dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} representing the ordinate of the scaling vector. If not present, its default value is <em><strong>sx</strong></em>, leading to a uniform scaling preserving the shape of the element.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"><img alt="transform_functions_scale_cart.png" class="internal default" src="/@api/deki/files/5805/=transform_functions_scale_cart.png"></td> <td><img alt="transform_functions_scale_homo.png" class="internal default" src="/@api/deki/files/5806/=transform_functions_scale_homo.png"></td> <td colspan="1" rowspan="2"><img alt="transform_functions_scale_homo.png" class="internal default" src="/@api/deki/files/5806/=transform_functions_scale_homo.png"></td> <td> </td> </tr> <tr> <td><code>[sx 0 0 sy 0 0]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>scale3d()</code></h3>
<p>The <code>scale3d()</code> CSS function modify the size of the element. It can either augment or decrease its size and as the amount of scaling is defined by a vector, if can do so more in one direction than in another one.</p>
<p>This transformation is characterized by a vector whose coordinates define how much scaling is done in each direction. If all three coordinates of the vector are equals, the scaling is uniform, or isotropic, and the shape of the element is preserved. In that case, the scaling function defines an homothetic transformation.</p>
<p>When outside the <code>]-1, 1[</code> range, the scaling enlarges the element in the direction of the coordinate; when inside the range, it shrinks the element in that direction. When equals to <code>1</code> it does nothing and when negative it performs a <em>point reflection</em> and the size modification.</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">scale3d(<em>sx</em>, <em>sy</em>, <em>sz</em>)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;"><em>sx</em></dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} representing the abscissa of the scaling vector.</dd> <dt style="margin-left: 40px;"><em>sy</em></dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} representing the ordinate of the scaling vector.</dd> <dt style="margin-left: 40px;">sz</dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} representing the z-component of the scaling vector.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="2" rowspan="2">This is transform in the 3D space and cannot be represented on the plan.</td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[]</code></td> </tr> </tbody>
</table>
<h3><code>scaleX()</code></h3>
<p><img align="left" alt="transform-functions-scaleX_2.png" class="internal lwrap" src="/@api/deki/files/5807/=transform-functions-scaleX_2.png?size=webview" style="width: 350px; height: 296px;">The <code>scaleX()</code> CSS function modify the abscissa of each element point by a constant factor. Except if this scale factor is <code>1</code>, in which case the function is the identity transform, the scaling is not isotropic and the angles of the element are not conserved.</p>
<p><code>scaleX(sx)</code> is a shorthand for <code>scale(sx, 1)</code> or for <code>scale3d(sx, 1, 1)</code>.</p>
<p><code>scaleX(-1)</code> defines an <a class="external" href="http://en.wikipedia.org/wiki/Axial_symmetry" title="http://en.wikipedia.org/wiki/Axial_symmetry">axial symmetry</a> with a vertical axis passing by the origin (as specified by the <code><a href="transform-origin" rel="custom">transform-origin</a></code> property).</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">scaleX(<em>s</em>)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;"><em>s</em></dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} representing the scaling factor to apply on the abscissa of each point of the element.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"><img alt="transform_functions_scaleX_homo.png" class="internal default" src="/@api/deki/files/5809/=transform_functions_scaleX_homo.png"></td> <td><img alt="transform_functions_scaleX_cart.png" class="internal default" src="/@api/deki/files/5808/=transform_functions_scaleX_cart.png" style=""></td> <td colspan="1" rowspan="2"><img alt="transform_functions_scaleX_cart.png" class="internal default" src="/@api/deki/files/5808/=transform_functions_scaleX_cart.png" style=""></td> <td> </td> </tr> <tr> <td><code>[s 0 0 1 0 0]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>scaleY()</code></h3>
<p><img align="left" alt="transform-functions-scaleY_2.png" class="internal lwrap" src="/@api/deki/files/5967/=transform-functions-scaleY_2.png"></p>
<p>The <code>scaleY()</code> CSS function modify the ordinate of each element point by a constant factor. Except if this scale factor is <code>1</code>, in which case the function is the identity transform, the scaling is not isotropic and the angles of the element are not conserved.</p>
<p><code>scaleY(sy)</code> is a shorthand for <code>scale(1, sy)</code> or for <code>scale3d(1, sy, 1)</code>.</p>
<p><code>scaleY(-1)</code> defines an <a class="external" href="http://en.wikipedia.org/wiki/Axial_symmetry" title="http://en.wikipedia.org/wiki/Axial_symmetry">axial symmetry</a> with an horizontal axis passing by the origin (as specified by the <code><a href="transform-origin" rel="custom">transform-origin</a></code> property).</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">scaleY(s)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;"><em>s</em></dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} representing the scaling factor to apply on the ordinate of each point of the element.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"><img alt="transform_functions_scaleY_cart.png" class="internal default" src="/@api/deki/files/5968/=transform_functions_scaleY_cart.png"></td> <td><img alt="transform_functions_scaleY_homo.png" class="internal default" src="/@api/deki/files/5969/=transform_functions_scaleY_homo.png"></td> <td colspan="1" rowspan="2"><img alt="transform_functions_scaleY_homo.png" class="internal default" src="/@api/deki/files/5969/=transform_functions_scaleY_homo.png"></td> <td> </td> </tr> <tr> <td><code>[1 0 0 s 0 0]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>scaleZ()</code></h3>
<p>The <code>scaleZ()</code> CSS function modify the z-coordinate of each element point by a constant factor. Except if this scale factor is <code>1</code>, in which case the function is the identity transform, the scaling is not isotropic and the angles of the element are not conserved.</p>
<p><code>scaleZ(sz)</code> is a shorthand for <code>scale3d(1, 1, sz)</code>.</p>
<p><code>scaleZ(-1)</code> defines an <a class="external" href="http://en.wikipedia.org/wiki/Axial_symmetry" title="http://en.wikipedia.org/wiki/Axial_symmetry">axial symmetry</a> along the z-axis passing by the origin (as specified by the <code><a href="transform-origin" rel="custom">transform-origin</a></code> property).</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">scaleZ(s)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;"><em>s</em></dt> <dd style="margin-left: 40px;">Is a {{ xref_cssnumber() }} representing the scaling factor to apply on the z-coordinate of each point of the element.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="2" rowspan="2">This is transform in the 3D space and cannot be represented on the plan.</td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[1 0 0 s 0 0]</code></td> </tr> </tbody>
</table>
<h3 style="clear:left;"><code>skew()</code></h3>
<p>The <code>skew()</code> CSS function is a shear mapping, or transvection, distorting each point of an element by a certain angle in each direction. It is done by increasing each coordinate by a value proportionate to the specified angle and to the distance to the origin. The more far from the origin, the more away the point is, the greater will be the value added to it.</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">skew(<em>ax</em>)       <em>or</em>
skew(<em>ax</em>, <em>ay</em>)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;"><em>ax</em></dt> <dd style="margin-left: 40px;">Is an {{ xref_cssangle() }} representing the angle to use to distort the element along the abscissa.</dd> <dt style="margin-left: 40px;"><em>ay</em></dt> <dd style="margin-left: 40px;">Is an {{ xref_cssangle() }} representing the angle to use to distort the element along the ordinate.</dd> <dt>
</dt></dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"> </td> <td> </td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[1 tan(ay) tan(ax) 1 0 0]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>skewX()</code></h3>
<p>The <code>skewX()</code> CSS function is an horizontal shear mapping distorting each point of an element by a certain angle in the horizontal direction. It is done by increasing the abscissa coordinate by a value proportionate to the specified angle and to the distance to the origin. The more far from the origin, the more away the point is, the greater will be the value added to it.</p>
<h4 class="editable" style="clear:left;"><span>Syntax</span></h4>
<pre class="eval">skewX(a)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;"><em>a</em></dt> <dd style="margin-left: 40px;">Is an {{ xref_cssangle() }} representing the angle to use to distort the element along the abscissa.</dd> <dt>
</dt></dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"> </td> <td> </td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[1 0 tan(a) 1 0 0]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>skewY()</code></h3>
<p>The <code>skewY()</code> CSS function is an vertical shear mapping distorting each point of an element by a certain angle in the vertical direction. It is done by increasing the ordinate coordinate by a value proportionate to the specified angle and to the distance to the origin. The more far from the origin, the more away the point is, the greater will be the value added to it.</p>
<h4 class="editable" style="clear:left;"><span>Syntax</span></h4>
<pre class="eval">skewX(a)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;"><em>a</em></dt> <dd style="margin-left: 40px;">Is an {{ xref_cssangle() }} representing the angle to use to distort the element along the ordinate.</dd> <dt>
</dt></dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"> </td> <td> </td> <td colspan="1" rowspan="2"> </td> <td> </td> </tr> <tr> <td><code>[1 tan(a) 0 1 0 0]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>skewY()</code></h3>
<pre class="eval">skewY(angle)
</pre>
<p>Skews the element around the Y axis by the given <code>angle</code>.</p>
<h3><code>translate()</code></h3>
<p><img align="left" alt="transform-functions-translate_2.png" class="internal lwrap" src="/@api/deki/files/5970/=transform-functions-translate_2.png" style="">The <code>translate()</code> CSS function moves the position of the element on the plane. This transformation is characterized by a vector whose coordinates define how much it moves in each direction.</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">translate(tx)       <em>or</em>
translate(tx, ty)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">tx</dt> <dd style="margin-left: 40px;">Is a {{ xref_csslength() }} representing the abscissa of the translating vector.</dd> <dt style="margin-left: 40px;">ty</dt> <dd style="margin-left: 40px;">Is a {{ xref_csslength() }} representing the ordinate of the translating vector. If missing, it is assumed to be equals to <strong>tx</strong> :  <code>translate(2)</code> means <code>translate(2, 2)</code>.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"> <p>A translation is not a linear transform in ℝ<sup>2</sup> and cannot be represented using a matrix in the cartesian coordinates system.</p> </td> <td><img alt="transform_functions_translate_homo.png" class="internal default" src="/@api/deki/files/5973/=transform_functions_translate_homo.png"></td> <td colspan="1" rowspan="2"><img alt="transform_functions_translate_homo.png" class="internal default" src="/@api/deki/files/5973/=transform_functions_translate_homo.png"></td> <td> </td> </tr> <tr> <td><code>[1 0 0 1 tx ty]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>translate3d()</code></h3>
<p>The <code>translate3d()</code> CSS function moves the position of the element in the 3D space. This transformation is characterized by a 3-dimension vector whose coordinates define how much it moves in each direction.</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">translate3d(tx, ty, tz)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">tx</dt> <dd style="margin-left: 40px;">Is a {{ xref_csslength() }} representing the abscissa of the translating vector.</dd> <dt style="margin-left: 40px;">ty</dt> <dd style="margin-left: 40px;">Is a {{ xref_csslength() }} representing the ordinate of the translating vector.</dd> <dt style="margin-left: 40px;">tz</dt> <dd style="margin-left: 40px;">Is a {{ xref_csslength() }} representing the z component of the translating vector. It can't be a {{ xref_csspercentage() }} value; in that case the property containing the transform is considered invalid.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="2" rowspan="2"> <p>This is transform in the 3D space and cannot be represented on the plan.</p> </td> <td colspan="1" rowspan="2">A translation is not a linear transform in ℝ<sup>3</sup> and cannot be represented using a matrix in the Cartesian coordinates system.</td> <td> </td> </tr> <tr> <td>[]</td> </tr> </tbody>
</table>
<h3><code>translateX()</code></h3>
<p><img align="left" alt="transform-functions-translateX_2.png" class="internal lwrap" src="/@api/deki/files/5972/=transform-functions-translateX_2.png" style="">The <code>translateX()</code> CSS function moves horizontally the element on the plane. This transformation is characterized by a {{ xref_csslength() }} defining how much it moves horizontally.</p>
<p><code>translateX(tx)</code> is a shortcut for <code>translate(tx, 0)</code>.</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">translateX(t)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">t</dt> <dd style="margin-left: 40px;">Is a {{ xref_csslength() }} representing the abscissa of the translating vector.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"> <p>A translation is not a linear transform in ℝ<sup>2</sup> and cannot be represented using a matrix in the cartesian coordinates system.</p> </td> <td><img alt="transform_functions_translateX_homo.png" class="internal default" src="/@api/deki/files/5974/=transform_functions_translateX_homo.png"></td> <td colspan="1" rowspan="2"><img alt="transform_functions_translateX_homo.png" class="internal default" src="/@api/deki/files/5974/=transform_functions_translateX_homo.png"></td> <td> </td> </tr> <tr> <td><code>[1 0 0 1 t 0]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>translateY()</code></h3>
<p><img align="left" alt="transform-functions-translateY_2.png" class="internal lwrap" src="/@api/deki/files/5971/=transform-functions-translateY_2.png" style="">The <code>translateY()</code> CSS function moves vertically the element on the plane. This transformation is characterized by a {{ xref_csslength() }} defining how much it moves vertically.</p>
<p><code>translateY(ty)</code> is a shortcut for <code>translate(0, ty)</code>.</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">translateY(t)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">t</dt> <dd style="margin-left: 40px;">Is a {{ xref_csslength() }} representing the z-component of the translating vector. It can't be a {{ xref_csspercentage() }} value; in that case the property containing the transform is considered invalid.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="1" rowspan="2"> <p>A translation is not a linear transform in ℝ<sup>2</sup> and cannot be represented using a matrix in the cartesian coordinates system.</p> </td> <td><img alt="transform_functions_translateY_homo.png" class="internal default" src="/@api/deki/files/5975/=transform_functions_translateY_homo.png"></td> <td colspan="1" rowspan="2"><img alt="transform_functions_translateY_homo.png" class="internal default" src="/@api/deki/files/5975/=transform_functions_translateY_homo.png"></td> <td> </td> </tr> <tr> <td><code>[1 0 0 1 0 t]</code></td> <td> </td> </tr> </tbody>
</table>
<h3><code>translateZ()</code></h3>
<p>The <code>translateZ()</code> CSS function moves the element along the z-axis of the 3D space. This transformation is characterized by a {{ xref_csslength() }} defining how much it moves.</p>
<p><code>translateZ(tz)</code> is a shorthand for <code>translate3d(0, 0, tz)</code>.</p>
<h4 style="clear:left;">Syntax</h4>
<pre class="eval">translateZ(t)
</pre>
<p>where :</p>
<dl> <dt style="margin-left: 40px;">t</dt> <dd style="margin-left: 40px;">Is a {{ xref_csslength() }} representing the ordinate of the translating vector.</dd>
</dl>
<table class="standard-table"> <thead> <tr> <th scope="col">Cartesian coordinates on ℝ<sup>2</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>2</sup></th> <th scope="col">Cartesian coordinates on ℝ<sup>3</sup></th> <th scope="col">Homogenous coordinates on ℝℙ<sup>3</sup></th> </tr> </thead> <tbody> <tr> <td colspan="2" rowspan="2">This is transform in the 3D space and cannot be represented on the plan.</td> <td colspan="1" rowspan="2">A translation is not a linear transform in ℝ<sup>3</sup> and cannot be represented using a matrix in the Cartesian coordinates system.</td> <td> </td> </tr> <tr> <td><code>[]</code></td> </tr> </tbody>
</table>
Revert to this revision