A special 3D rotating cube animation effect-

Source: Internet
Author: User
This is an interactive 360-degree superb 3D rotating cube animation effect. You can drag the cube with the mouse to view each plane, or click the navigation link page on the left to switch to the corresponding plane of the cube. This 3D cube special effect uses an element as the packaging container, and then uses 6 ...,. Brief tutorial

This is an interactive 360-degree superb 3D rotating cube animation effect. You can drag the cube with the mouse to view each plane, or click the navigation link page on the left to switch to the corresponding plane of the cube.

  Usage

  

 HTML Structure

This 3D cube special effect uses

The element is used as the package container, and then six sub-

As the six sides of the cube, there is also a small cube in the cube, and its six sides are pasted with different images.

01 

02

03

04

05

06

07

08

09 10

11

12

13

14

15

16

17

18

19

  CSS style

The wrap container. container sets the perspective effect because IE does not support transform-style: preserve-3d; properties, so 3D cube effects cannot be seen.

.container {  position: relative;  margin: 0 auto;  width: 100vw;  height: 100vh;  overflow: hidden;  -webkit-perspective: 750px;          perspective: 750px;  -webkit-transform-style: preserve-3d;          transform-style: preserve-3d;}

In the internal container. inner, modify the perspective origin to the center of the screen.

.container .inner {  -webkit-transform-style: preserve-3d;          transform-style: preserve-3d;  -webkit-transform-origin: 50vw 50vw 0;          transform-origin: 50vw 50vw 0;}

Other styles are basically a cube style. For details about how to use CSS to create a 3D cube, see the CSS3 3D transforms series tutorial-cube.

JavaScript

In this 3D cube special effect, JavaScript code is used to control the action of clicking on each plane of the cube, as well as the interaction effect when you drag the cube with the mouse, and when you click the link navigation on the left, rotate to the corresponding cube surface.

The above is a special 3D rotating cube animation effect. For more information, see PHP Chinese website (www.php1.cn )!

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.