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 )!