CSS3 for a cool 3D box flip effect

Source: Internet
Author: User

Brief introduction

Use CSS3 first in the plane space to form a cube box, and then let the whole box upside down, first:

Step 1: First put 6 pictures in CSS

Here is the 3D transform of the CSS3 to flip each face, making it a three-dimensional box, the code is as follows:

//left. Pic2 {    transform:rotatey (90deg);   //Flip 90 degrees along the y-axis    transform-origin: Right;    To the right of the axis }//front. pic6{    transform:Translatez (100%);   Vertical screen moves the length of the cube Outward }

Several other faces are flipped in the same way.

2. Animate the entire cube

When the three-dimensional box is finished, the three-dimensional box will flip to the effect of flipping as long as the entire box is animated:

//Custom Animation style @keyframes Mysec{0%{transform:Rotatex (0deg) Rotatey (0deg) Rotatez (0deg);}//Add styles as you want, and split the number of animation frames 50%{Transform:Rotatex (230deg) Rotatey ( -20deg) Rotatez ( -90deg);}100%{Transform:Rotatex ( -360deg) Rotatey (360deg) Rotatez ( -360deg);}}//adds a style to the container. Mydiv{Animation:Mysec 7s Infinite;//Call animation Transform-style:preserve-3d;//Specify container nesting elements three-dimensional rendering effect perspective:1000px;//Specify the perspective effect of 3D elements}

You can also apply animations for a single face, as in the steps above, as long as the animation continues and the delay time can achieve cool effect!

Final effect

If there are shortcomings, welcome the small partners to correct!

CSS3 for a cool 3D box flip effect

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.