Create a 3D scene from the CSS3

Source: Internet
Author: User

1. Introduction to Properties

Distance of perspective:800 plane distance from three-dimensional Chinese frame

perspective-origin:50% 50% indicates where the three-dimensional graph is viewed from the plane, equivalent to the x-axis and y-axis, which represents the center of the plane

2.transform Properties

--translete: Displacement operation

TranslateX (X px)

Translatey (Y px)

Translatez (Z px)

--rotate: Rotation operation

Rotatex (X deg)

Rotatey (Y deg)

Rotatez (Z deg)

3. Set 3D

transform-style:preserve-3d;

4. All browsers currently do not support perspective properties, only-webkit-support ~

5. Simple 3D Scene

[HTML]View PlainCopy
  1. <! DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title></title>
  5. <style type="Text/css">
  6. $a \
  7. -webkit-perspective:800;
  8. -webkit-perspective-origin:50% 50%;
  9. -webkit-transform-style:-webkit-preserve-3d;
  10. }
  11. %b=
  12. width:500px;
  13. height:500px;
  14. Background:blue;
  15. margin:0 Auto;
  16. -webkit-transform:rotatey (45DEG);
  17. }
  18. </style>
  19. </head>
  20. <body>
  21. <div id="a">
  22. <div id="B">
  23. </div>
  24. </div>
  25. </body>
  26. </html>

6. The concept of an axis

Coordinate system origin in upper-left corner

The positive direction of the x-axis is right

Y-Axis positive direction is down

Z-axis Positive direction is from the screen to the human eye (vertical)

For example Rotatex (80deg) and Rotatex ( -80deg) difference is: from the x-axis positive direction to the object, 80deg is clockwise rotation of 80 degrees, -80deg is counterclockwise rotation of 80 degrees

7.transform-origin: Adjusting the center of rotation

X-axis:

Left/center/right

Y-Axis:

Top/center/bottom

Z Axis:

Length px

Create a 3D scene from the CSS3

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.