Skip to content

Instantly share code, notes, and snippets.

@egibney
Created November 29, 2019 15:59
Show Gist options
  • Save egibney/18c7640d4f001202c46c8634461ac09b to your computer and use it in GitHub Desktop.
Save egibney/18c7640d4f001202c46c8634461ac09b to your computer and use it in GitHub Desktop.
* { box-sizing: border-box; }
body { font-family: sans-serif;
color: #000000; }
.scene {
width: 200px;
height: 300px;
border: 1px solid #CCC;
margin: 80px;
perspective: 400px;
}
.cube {
width: 200px;
height: 300px;
position: relative;
transform-style: preserve-3d;
transform: translateZ(-100px);
transition: transform 1s;
}
.cube.show-front { transform: translateZ(-100px) rotateY( 0deg); }
.cube.show-right { transform: translateZ(-100px) rotateY( -90deg); }
.cube.show-back { transform: translateZ(-100px) rotateY(-180deg); }
.cube.show-left { transform: translateZ(-100px) rotateY( 90deg); }
.cube__face {
position: absolute;
width: 200px;
height: 300px;
border: 2px solid black;
line-height: 200px;
font-size: 40px;
font-weight: bold;
color: white;
text-align: center;
}
.cube__face--front { transform: rotateY( 0deg) translateZ(100px); }
.cube__face--right { transform: rotateY( 90deg) translateZ(100px); }
.cube__face--back { transform: rotateY(180deg) translateZ(100px); }
.cube__face--left { transform: rotateY(-90deg) translateZ(100px); }
label { margin-right: 10px; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment