CSS3 conversion (Transform)

Source: Internet
Author: User

Convert transform

Ability to move, scale, rotate, lengthen, or stretch elements


In CSS, allows elements to achieve the conversion effect of 3D and both, mainly include: rotation, scaling, moving, tilt

The element can only be changed on the x-axis and the y-axis plane

3D: Elements can also change on the z axis


Value:

None : No conversion

Transform Functions:

Matrix ():

Specifies a 2D transformation in the form of a (a,b,c,d,e,f) transformation matrix with a value of six, equivalent to applying a [a,b,c,d,e,f] transformation matrix directly

Translate ():

Specifies the 2D translation (2D translation) of the object. The first parameter corresponds to the x-axis, and the second parameter corresponds to the y-axis. If the second parameter is not provided, the default value is 0

Translatex ():

Specifies the pan of the x-axis (horizontal orientation) of the object

Translatey ():

Specifies the translation of the y-axis (vertical direction) of the object

Rotate ():

2D rotation (2D rotation) of the specified object, preceded by the definition of < ' transform-origin ' > Properties

Scale ():

Specifies the 2D scale (2D scaling) of the object. The first parameter corresponds to the x-axis, and the second parameter corresponds to the y-axis. If the second parameter is not provided, the value of the first parameter is taken by default

ScaleX ():

Specifies the (horizontal) scaling of the x-axis of an object

ScaleY ():

Specifies the (vertical) scaling of the y-axis of an object

Skew ():

Specifies the object skew transformation (skew-cut skew). The first parameter corresponds to the x-axis, and the second parameter corresponds to the y-axis. If the second parameter is not provided, the default value is 0

SKEWX ():

Specifies the (horizontal) distortion of the x-axis of an object

Skewy ():

Specifies the (vertical) distortion of the y-axis of an object

3D Transform Functions:

Matrix3D ():

Specify a 3D transformation in the form of a 4x4 matrix

Translate3d ():

Specifies the 3D displacement of the object. The 1th parameter corresponds to the x-axis, the 2nd parameter corresponds to the y-axis, the 3rd parameter corresponds to the z-axis, and the parameter does not allow omitting

Translatez ():

Specifies the translation of the z-axis of an object

Rotate3d ():

Specifies the 3D rotation angle of the object, where the first 3 parameters represent the direction of rotation x, Y, Z, and the 4th parameter represents the angle of rotation, and the parameter does not allow omitting

Rotatex ():

Specify the rotation angle of the object on the x-axis

Rotatey ():

Specify the rotation angle of the object on the y-axis

Rotatez ():

Specify the rotation angle of the object on the z axis

Scale3d ():

Specifies the 3D scale of the object. The 1th parameter corresponds to the x-axis, the 2nd parameter corresponds to the y-axis, the 3rd parameter corresponds to the z-axis, and the parameter does not allow omitting

Scalez ():

Specifies the z-axis scaling of an object

Perspective ():

Specify perspective distance


1, 2D conversion

The conversion effect on the X and y axes of an element can be called a 2D transformation, including: displacement, scaling, rotation, tilt


1-1. Displacement translate ()

Let the element produce a position of movement change effect

function : Translate (one value)--only in x-axis displacement distance

Translate (value 1, value 2)--displacement distance at x and y axes

Take value : Value | percentage, can take negative values

X is positive, then moves to the right and X is negative, then moves to the left.

Y is positive, then moves downward; Y is negative, then it moves up.


The code examples are as follows:

<!doctype html>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/8A/9C/wKioL1g1X2CRhOCeAAAE3Bu7CuI980.png "title=" Qq20161123172015.png "alt=" Wkiol1g1x2crhoceaaae3bu7cui980.png "/>


1-2. Scaling scale ()

Changing the size of an element is called scaling

function : Scale (), scale (×), scale (x, y)

Note: If you give only one value, then the second default is equal to the first value

Take value : The default value is 1

Zoom out: Values from 0 to 1

Zoom in: Values greater than 1


The code examples are as follows:

<!doctype html>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/8A/9C/wKioL1g1YkiA_IELAAAPatS2CTE470.png "title=" Qq20161123173238.png "alt=" Wkiol1g1ykia_ielaaapats2cte470.png "/>



Origin of the conversion transform-origin

Default location : The origin point is at the center of the element

Take value : value | percent | keywords

Two values : Represents the position of the X and Y axes

Three values : Represents x-axis, y-axis, z-axis


Compatibility:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/8A/9F/wKiom1g1WwTwFOVuAABAfqDgTYI449.png "title=" Qq20161123170126.png "alt=" Wkiom1g1wwtwfovuaabafqdgtyi449.png "/>














This article is from the "Dapengtalk" blog, make sure to keep this source http://dapengtalk.blog.51cto.com/11549574/1875900

CSS3 conversion (Transform)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.