What I'm trying to achieve is the transition of the page like on this webpage - http://ejosue.com/.
So far what I have done is created a cube with an on hover effect which works pretty much like on the website. Now however I have a problem with making the cube fill the entire screen (like on the referenced webpage).
Here's the JSfiddle - https://jsfiddle.net/definaly/31zr05y7/48/
And the code on this page
body { font-family: sans-serif; }
.scene {
width: 200px;
height: 200px;
}
.cube {
width: 100%;
height: 100%;
position: relative;
transform-style: preserve-3d;
transition: transform 1s;
}
.cube:hover{
animation: pageDown 1.5s linear forwards;
}
#keyframes pageDown{
25%{
transform: scale(0.8);
}
75%{
transform: rotateX(90deg);
}
100%{
transform: scale(1);
transform: rotateX(90deg);
}
}
.cube__face {
position: absolute;
width: 100%;
height: 100%;
border: 2px solid black;
/* Optional Styling */
line-height: 200px;
font-size: 30px;
font-weight: bold;
color: white;
text-align: center;
}
.cube__face--front {
background: hsla( 0, 100%, 50%, 1);
}
.cube__face--bottom {
background: hsla(300, 100%, 50%, 1);
}
.cube__face--front {
transform: rotateY(0deg) translateZ(100px);
}
.cube__face--bottom {
transform: rotateX(-90deg) translateZ(100px);
}
<div class="scene">
<div class="cube">
<div class="cube__face cube__face--front">entry page</div>
<div class="cube__face cube__face--bottom">extra page</div>
</div>
</div>
Simply make the scene element 100vh and consider 50vh inside the translation. Also remove the width to have the default full width:
body { font-family: sans-serif;margin:0; } /* Remove the default margin */
* {
box-sizing:border-box; /* to make sure there is no overflow*/
}
.scene {
height: 100vh;
}
.cube {
height: 100%;
position: relative;
transform-style: preserve-3d;
transition: transform 1s;
}
.cube:hover{
animation: pageDown 1.5s linear forwards;
}
#keyframes pageDown{
25%{
transform: scale(0.8);
}
75%{
transform: rotateX(90deg);
}
100%{
transform: scale(1);
transform: rotateX(90deg);
}
}
.cube__face {
position: absolute;
width: 100%;
height: 100%;
border: 2px solid black;
/* Optional Styling */
line-height: 200px;
font-size: 30px;
font-weight: bold;
color: white;
text-align: center;
}
.cube__face--front {
background: hsla( 0, 100%, 50%, 1);
}
.cube__face--bottom {
background: hsla(300, 100%, 50%, 1);
}
.cube__face--front {
transform: rotateY(0deg) translateZ(50vh);
}
.cube__face--bottom {
transform: rotateX(-90deg) translateZ(50vh);
}
<div class="scene">
<div class="cube">
<div class="cube__face cube__face--front">entry page</div>
<div class="cube__face cube__face--bottom">extra page</div>
</div>
</div>
Related
So I have a rotating pyramid which has text and a button on each face, but the buttons are unresponsive due to overlapping divs.
Is there any way to make the buttons clickable in the rotating pyramid ?
-sorry for the ugly code, it's only a prototype.
body {
padding-top: 230px;
}
.tetra {
position: relative;
transform-origin: 50% 56%;
width: 700px;
padding-bottom: 606.21px;
/* height of equilateral triangle = sin60° * width */
margin: 0 auto;
transform-style: preserve-3d;
transition: transform 1s;
}
.tetra div {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent;
transform-style: preserve-3d;
-webkit-clip-path: polygon(50% 0, 100% 100%, 0% 100%);
clip-path: polygon(50% 0, 100% 100%, 0% 100%);
}
/* Rotation of –109.5° is angle(C, M[AB], D), per http://www.f-lohmueller.de/pov_tut/geo/geom_200e.htm, 180° – atan(2 * sqrt(2)) ≈ 109.5° */
.tetra .face2 {
transform-origin: 0% 100%;
transform: rotate(-60deg) rotatex(-109.5deg);
background: rgb(190, 0, 0);
}
.tetra .face3 {
transform-origin: 100% 100%;
transform: rotate(60deg) rotatex(-109.5deg);
background-color:blue;
}
.tetra .face4 {
transform-origin: 50% 100%;
transform: rotate(180deg) rotatex(-109.5deg);
background: rgb(76, 190, 0);
}
.tetra .face4 p {
transform: scale(-1, 1);
top: 60%;
left: 50%;
text-align: center;
width: 93px;
margin: 0px;
position: relative;
font-size: 30px;
position: relative;
font-weight: bold;
}
.tetra .face2 p {
transform: scale(-1, 1);
font-size: 30px;
text-align: center;
top: 60%;
left: 50%;
position: relative;
width: 93px;
margin: 0px;
font-weight: bold;
}
.tetra .face3 p {
transform: scale(-1, 1);
font-size: 30px;
text-align: center;
top: 60%;
left: 45%;
position: relative;
width: 40%;
font-weight: bold;
}
#keyframes rotate {
0% {
transform: rotatex(90deg) rotateY(0deg) rotatez(0deg);
}
100% {
transform: rotatex(90deg) rotateY(0deg) rotatez(360deg);
}
}
<html>
<head>
<link rel="stylesheet" href="pyramid.css">
</head>
<div style="height:100px;" onmousedown="spin()">
<div class="tetra">
<div class="face1"></div>
<div class="face2">
<p>TEXTFACE2<button onclick="window.Open(cube.html)">buttonface2</button></p>
</div>
<div class="face4">
<p>TEXTFACE3<button onclick="window.Open(cube.html)">buttonface4</button></p>
</div>
<div class="face3" "><p>TEXTFACE3<button onclick="window.Open(cube.html) "">buttonface3</button>
</p>
</div>
</div>
</div>
<script>
let rotation = 0;
function spin() {
const collection = document.getElementsByClassName("tetra");
collection[0].style.transform = "rotatex(90deg) rotateY(0deg) rotateZ(" + rotation + "deg)";
rotation = rotation + 120;
}
</script>
<style>
.tetra {
transform: rotatex(90deg) rotateY(0deg) rotatez(0deg);
}
</style>
</html>
I'm trying to animate the faces of an isometric cube I've created using CSS transforms to create an 'unpacking/unfolding' effect.
I want the lid of the cube to rotate upwards but at the moment it floats off rather than rotates from the edge. It starts and ends in the right places. I've tried changing the transform-origin property but it doesn't make a difference. Here's my code so far:
https://jsfiddle.net/wrgt1/5yrLjnw3/38/
html body {
position: relative;
height: 100vh;
width: 100vw;
background-color: #C4C5C4;
}
.front,
.back {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
}
.front {
z-index: 99;
}
.cube {
transform-style: preserve-3d;
transform: rotateX(-35deg) rotateY(45deg);
}
.face {
position: absolute;
width: 30vh;
height: 30vh;
background: white;
border: solid 1px blue;
}
.top {
transform-origin: 100% 100%;
transform: rotateX(90deg) rotateY(0deg) translate3d(15vh, 0, 15vh);
animation: rotatelid 5s linear infinite alternate;
}
.frontleft {
transform: rotateY(-90deg) translate3d(0, 0, 15vh);
}
.frontright {
transform: translate3d(0, 0, 15vh);
}
.backleft {
transform: translate3d(0, 0, -15vh);
background: lightgrey;
}
.backright {
transform: rotateY(-90deg) translate3d(0, 0, -15vh);
}
#keyframes rotatelid {
from {
transform: rotateX(90deg) rotateY(0deg) translate3d(15vh, 0, 15vh);
}
to {
transform: rotateX(90deg) rotateY(90deg) translate3d(-15vh, 0vh, 15vh);
}
}
<div class='front'>
<div class='cube'>
<div class='face top'></div>
<div class='face frontleft'></div>
<div class='face frontright'></div>
</div>
</div>
<div class='back'>
<div class='cube'>
<div class='face backleft'></div>
<div class='face backright'></div>
</div>
</div>
Does anyone know how to solve this problem, or if there's a better way to create simple animations on the web (possibly using SVGs?).
Update the order of your transformation to first translate the element then rotate it. Pay attention to the translation because it's no more the same when added first.
html body {
position: relative;
height: 100vh;
margin:0;
background-color: #C4C5C4;
}
.front,
.back {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
}
.front {
z-index: 99;
}
.cube {
transform-style: preserve-3d;
transform: rotateX(-35deg) rotateY(45deg);
}
.face {
position: absolute;
width: 30vh;
height: 30vh;
background: white;
border: solid 1px blue;
box-sizing:border-box;
}
.top {
transform-origin: 100% 100%;
transform: translate3d(15vh, -15vh, 0vh) rotateX(90deg) rotateY(0deg);
animation: rotatelid 5s linear infinite alternate;
}
.frontleft {
transform: rotateY(-90deg) translate3d(0, 0, 15vh);
}
.frontright {
transform: translate3d(0, 0, 15vh);
}
.backleft {
transform: translate3d(0, 0, -15vh);
background: lightgrey;
}
.backright {
transform: rotateY(-90deg) translate3d(0, 0, -15vh);
}
#keyframes rotatelid {
from {
transform:translate3d(15vh, -15vh, 0vh) rotateX(90deg) rotateY(0deg);
}
to {
transform:translate3d(15vh, -15vh, 0vh) rotateX(90deg) rotateY(90deg);
}
}
<div class='front'>
<div class='cube'>
<div class='face top'></div>
<div class='face frontleft'></div>
<div class='face frontright'></div>
</div>
</div>
<div class='back'>
<div class='cube'>
<div class='face backleft'></div>
<div class='face backright'></div>
</div>
</div>
For a movie website I have a moving background with a grain texture to create a movie vibe.
Later in the website I want to have a :hover input, but because of the grain background it doesn't seem to work.
The background will be attached to the section and when you hover over the div with the class hover, the content from the test div need to be show up.
This is my HTML and CSS:
.section {
background-color: black;
padding-top: 12rem;
height: 1000px;
width: 100vw;
}
.section:after {
animation: grain 8s steps(10) infinite;
background-image: url(https://previews.123rf.com/images/maximkostenko/maximkostenko1602/maximkostenko160200071/53576792-grain-texture-overlay-background-for-your-desig-dusty-overlay-texture.jpg);
content: "";
height: 300%;
left: -50%;
opacity: 0.05;
position: fixed;
top: -110%;
width: 300%;
}
#keyframes grain {
0%,
100% {
transform: translate(0, 0);
}
10% {
transform: translate(-5%, -10%);
}
20% {
transform: translate(-15%, 5%);
}
30% {
transform: translate(7%, -25%);
}
40% {
transform: translate(-5%, 25%);
}
50% {
transform: translate(-15%, 10%);
}
60% {
transform: translate(15%, 0%);
}
70% {
transform: translate(0%, 15%);
}
80% {
transform: translate(3%, 35%);
}
90% {
transform: translate(-10%, 10%);
}
}
.hover {
width: 100px;
height: 100px;
background-color: red;
}
.test {
display: none;
color: white;
}
.hover:hover+.test {
display: block;
}
<section class="section">
<div class="hover">
</div>
<div class="test">test</div>
</section>
Here is the JSFiddle:
https://jsfiddle.net/g8dhz14j/3/
When I try the code without the .section:after, the code works. Can someone help out?
Add pointer-events: none; to the .section::after rules.
.section {
background-color: black;
padding-top: 12rem;
height: 1000px;
width: 100vw;
}
.section::after {
animation: grain 8s steps(10) infinite;
background-image: url(https://previews.123rf.com/images/maximkostenko/maximkostenko1602/maximkostenko160200071/53576792-grain-texture-overlay-background-for-your-desig-dusty-overlay-texture.jpg);
content: "";
height: 300%;
left: -50%;
opacity: 0.05;
position: fixed;
top: -110%;
width: 300%;
z-index: 0;
pointer-events: none;
}
#keyframes grain {
0%,
100% {
transform: translate(0, 0);
}
10% {
transform: translate(-5%, -10%);
}
20% {
transform: translate(-15%, 5%);
}
30% {
transform: translate(7%, -25%);
}
40% {
transform: translate(-5%, 25%);
}
50% {
transform: translate(-15%, 10%);
}
60% {
transform: translate(15%, 0%);
}
70% {
transform: translate(0%, 15%);
}
80% {
transform: translate(3%, 35%);
}
90% {
transform: translate(-10%, 10%);
}
}
.hover {
width: 100px;
height: 100px;
background-color: red;
}
.blue {
display: none;
color: white;
}
.hover:hover+.blue {
display: block;
}
<section class="section">
<div class="hover">
</div>
<div class="blue">THIS IS A TEST</div>
</section>
The :after pseudo element is on top of the .hover element. You can change that by using z-index:
.section {
background-color: black;
padding-top: 12rem;
height: 1000px;
width: 100vw;
}
.section:after {
animation: grain 8s steps(10) infinite;
background-image: url(https://previews.123rf.com/images/maximkostenko/maximkostenko1602/maximkostenko160200071/53576792-grain-texture-overlay-background-for-your-desig-dusty-overlay-texture.jpg);
content: "";
height: 300%;
left: -50%;
opacity: 0.05;
position: fixed;
top: -110%;
width: 300%;
}
#keyframes grain {
0%,
100% {
transform: translate(0, 0);
}
10% {
transform: translate(-5%, -10%);
}
20% {
transform: translate(-15%, 5%);
}
30% {
transform: translate(7%, -25%);
}
40% {
transform: translate(-5%, 25%);
}
50% {
transform: translate(-15%, 10%);
}
60% {
transform: translate(15%, 0%);
}
70% {
transform: translate(0%, 15%);
}
80% {
transform: translate(3%, 35%);
}
90% {
transform: translate(-10%, 10%);
}
}
.hover {
width: 100px;
height: 100px;
background-color: red;
position: relative;
z-index: 1;
}
.test {
display: none;
color: white;
}
.hover:hover + .test {
display: block;
}
<section class="section">
<div class="hover"></div>
<div class="test">THIS IS A TEST</div>
</section>
I'm trying to create a "3 photo cube" with cube effect rotating.
Found a very helpful codepen which created the cube with 4 sides and did the rotating and stopping by side which was exactly what i wanted.
Issue here is that i need the cube to show just 3 sides not 4 and when i remove one of them, it still rotates on that side.
I thought i should just "match" top side bottom side so the back side doesn't show but it seems i am having a little knowledge at understanding how the positioning works.
see the below snippet.
.scene {
width: 416px;
height: 500px;
margin: 75px auto 0;
perspective: 1200px;
}
.cube {
position: relative;
width: 416px;
height: 500px;
transform-style: preserve-3d;
transform: translateZ(0px) rotateX(150deg);
animation: example 15s linear infinite;
}
.side {
position: absolute;
width: 416px;
height: 500px;
box-sizing: border-box;
background-color: #999;
background-size: 100% 100%;
background-repeat: no-repeat;
padding: 120px 0;
font: 50px/1 'Trebuchet MS', sans-serif;
color: #fff;
text-transform: uppercase;
text-align: center;
}
.side::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.15);
}
.side span {
position: relative;
}
.guides {
position: absolute;
top: 0;
left: 50px;
width: 200px;
height: 100%;
border-style: dotted;
border-width: 0 1px;
color: rgba(255, 255, 255, 0.6);
}
.guides::before {
content: '';
position: absolute;
top: 0;
left: 50%;
width: 0;
height: 100%;
border-left: 1px dotted;
}
.back {
transform: translateZ(-250px) rotateX(180deg);
}
.bottom {
transform: translateY(250px) rotateX(270deg);
}
.front {
transform: translateZ(250px);
}
.top {
background-image: url(https://askd.github.io/codepen/top.jpg);
}
.back {
background-image: url(http://keit.rezsolution.com/wp-content/uploads/2019/07/rimodelimi-i-hundes-galeri.jpg);
}
.bottom {
background-image: url(http://keit.rezsolution.com/wp-content/uploads/2019/07/foto-galeri-zmadhimi-i-gjoksit.jpg);
}
.front {
background-image: url(http://keit.rezsolution.com/wp-content/uploads/2019/07/barku-home.jpg);
}
#keyframes example {
0% { transform: translateZ(-150px) rotateX(0deg); }
15% { transform: translateZ(-150px) rotateX(90deg); }
25% { transform: translateZ(-150px) rotateX(90deg); }
40% { transform: translateZ(-150px) rotateX(180deg); }
50% { transform: translateZ(-150px) rotateX(180deg); }
65% { transform: translateZ(-150px) rotateX(270deg); }
75% { transform: translateZ(-150px) rotateX(270deg); }
90% { transform: translateZ(-150px) rotateX(360deg); }
100% { transform: translateZ(-150px) rotateX(360deg); }
}
<div class="scene">
<div class="cube">
<div class="side back">
<span>BACK</span>
</div>
<div class="side bottom">
<span>BOTTOM</span>
</div>
<div class="side front">
<span>FRONT</span>
</div>
</div>
</div>
Anybody can give me some directions on how to approach this issue?
Any help is appreciated
I made a working exemple of a rotating prism (Y axis) here.
And the same on the X axis here.
There are 2 things to figure out, the distance to translate each face and the rotation angle.
The distance bring back to trigonometry which made my brain hurt a little, but to make it simple, in this case you get it by doing : translationDistance = (faceWidth/2) / tan(30).See this article by David DeSandro for more explanations.
In my code :
--cotetriangle: 200px;
/* r = 100 / tan(30) = 57.7 */
--translationDistance: 58px;
The angle of rotation is easy, 3 faces, 360deg -> 120deg for each rotation.
Which gives you :
.triangle-face-front {
background: rgb(71, 71, 136);
transform: translate3d(0, 0, var(--translationDistance));
}
.triangle-face-left {
background: rgb(90, 233, 77);
transform: rotateY(-120deg) translate3d(0, 0, var(--translationDistance));
}
.triangle-face-right {
background: black;
transform: rotateY(120deg) translate3d(0, 0, var(--translationDistance));
}
I did a little 'pausing' animation as you suggested :
#keyframes rotateTriangle {
0% {
transform: rotateY(0deg);
}
24%,34%{
transform: rotateY(120deg);
}
58%,67%{
transform: rotateY(240deg);
}
91%, 100% {
transform: rotateY(360deg);
}
To switch between a lateral rotation (code above) and a frontal rotation, you just need to replace rotateY by rotateX
To understand better CSS 3D, I encourage you to read those 2 articles :
Intro to CSS 3D transforms by David DeSandro
Creating a 3D Cube Image Gallery by Kushagra Gour
I have created a 3d cube using CSS, now i want to rotate that cube on my HTML page. My problem is the when the cube rotates, it also moves to the sides, i need it to stay in place and rotate.
i've tried changing the posistion of my div to relative, which scattered the cube sides and still made it rotate to the sides.
I believe the problem has something to do with the transform-origin, however no matter how i change the values it doesn't help.
.spinner div {
position: absolute;
display: inline-block;
width: 300px;
height: 300px;
border: 2px solid rgb(0, 0, 0);
box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
text-align: center;
font-size: 100px;
}
.spinner .face1 {
transform: translateZ(150px);
background-color: blue;
}
.spinner .face2 {
transform: rotateY(90deg) translateZ(150px);
background-color: rgb(184, 187, 31);
}
.spinner .face3 {
transform: rotateY(180deg) translateZ(150px);
background-color: green;
}
.spinner .face4 {
transform: rotateY(-90deg) translateZ(150px);
background-color: red;
}
.spinner {
animation: spincube 6s infinite;
transform-style: preserve-3d;
transform-origin: 50% 0;
}
.center-screen {
display: flex;
flex-direction: column;
justify-content: top;
align-items: top;
text-align: center;
margin-top: 10%;
margin-left: 40%;
}
#keyframes spincube {
from {
transform: rotateY(0deg);
}
to {
transform: rotateY(-360deg)
}
}
<body>
<div class="center-screen">
<div class="spinner">
<div class="face1">1</div>
<div class="face2">2</div>
<div class="face3">3</div>
<div class="face4">4</div>
</div>
</div>
</body>
as described i expected the cube to stay in place but it slides out to the side.
I would re adjust the transformation like below to make sure the slides are around the center of the main element which is an empty element.
Note the use of translateX to achieve the needed effect.
.spinner div {
position: absolute;
width: 100px;
height: 100px;
border: 2px solid rgb(0, 0, 0);
box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
text-align: center;
font-size: 80px;
}
.spinner .face1 {
transform: translateZ(50px) translateX(-50%);
background-color: blue;
}
.spinner .face2 {
transform: rotateY(90deg);
background-color: rgb(184, 187, 31);
}
.spinner .face3 {
transform: translateZ(-50px) translateX(-50%) rotateY(180deg) ;
background-color: green;
}
.spinner .face4 {
transform: translateX(-100%) rotateY(-90deg);
background-color: red;
}
.spinner {
animation: spincube 6s infinite;
transform-style: preserve-3d;
display: inline-block; /* This is important !!*/
outline: 5px solid red; /* to illustrate */
}
.center-screen {
text-align: center;
margin-top: 10%;
}
#keyframes spincube {
to {
transform: rotateY(-360deg)
}
}
<div class="center-screen">
<div class="spinner">
<div class="face1">1</div>
<div class="face2">2</div>
<div class="face3">3</div>
<div class="face4">4</div>
</div>
</div>
You can also rely on left to handle this:
.spinner div {
position: absolute;
width: 100px;
left:-50px;
height: 100px;
border: 2px solid rgb(0, 0, 0);
box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
text-align: center;
font-size: 80px;
}
.spinner .face1 {
transform: translateZ(50px);
background-color: blue;
}
.spinner .face2 {
transform: rotateY(90deg);
background-color: rgb(184, 187, 31);
left:0;
}
.spinner .face3 {
transform: translateZ(-50px) rotateY(180deg) ;
background-color: green;
}
.spinner .face4 {
transform:rotateY(-90deg);
background-color: red;
left:-100px;
}
.spinner {
animation: spincube 6s infinite;
transform-style: preserve-3d;
display: inline-block; /* This is important !!*/
outline: 5px solid red; /* to illustrate */
position:relative;
}
.center-screen {
text-align: center;
margin-top: 10%;
}
#keyframes spincube {
to {
transform: rotateY(-360deg)
}
}
<div class="center-screen">
<div class="spinner">
<div class="face1">1</div>
<div class="face2">2</div>
<div class="face3">3</div>
<div class="face4">4</div>
</div>
</div>
You could do something like this:
Credits: https://codepen.io/bcgwebdesign/pen/gRXxxR?editors=0100
Tip: There are a lot of demos of this kind on Codepen
/* keyframes for rotating animation */
#-webkit-keyframes spinX {
from { transform: rotateY(0); }
to { transform: rotateY(360deg); }
}
#-webkit-keyframes spinBoth {
from { transform: rotateY(0) rotateX(0); }
to { transform: rotateY(360deg) rotateX(0deg) ; }
}
#-webkit-keyframes spinY {
from { transform: rotateX(0); }
to { transform: rotateX(360deg); }
}
#-webkit-keyframes recolor {
0% { background: rgba(0,255,0,0.1); }
33% { background: rgba(255,0,0,0.1); }
66% { background: rgba(0,0,255,0.1); }
}
/* scene wrapper */
.wrapper{
height: 300px;
margin-top:0;
position:relative;
perspective: 1000px;
perspective-origin: 50% -50px;
}
/* cube wrapper */
.cube {
position: relative;
margin: 200px auto;
width: 200px;
transform-style: preserve-3d;
animation: spinBoth 5s infinite ease-in-out;
transition: all 1s linear;
}
/* outer cube */
b {
position:absolute;
width:200px;
height:200px;
display:block;
background:rgba(255,0,0,0.1);
box-shadow:inset 0 0 30px rgba(0,0,0,0.2);
font-size:20px;
text-align:center;
line-height:200px;
color:rgba(0,0,0,0.5);
font-family:sans-serif;
text-transform:uppercase;
transition: all 1s linear;
}
b.back{
transform: translateY(-100px) translateZ(-100px) rotateY(180deg);
}
b.right{
transform:translateY(-100px) rotateY(-270deg) translateX(100px);
transform-origin: top right;
}
b.left{
transform:translateY(-100px)rotateY(270deg) translateX(-100px);
transform-origin: center left;
}
b.top{
transform:rotateX(-90deg) translateY(-100px) translateZ(-100px);
transform-origin: top center;
}
b.bottom{
transform:rotateX(90deg) translateY(100px) translateZ(100px);
transform-origin: bottom center;
}
b.front{
transform: translateZ(100px) translateY(-100px);
}
<div class="wrapper">
<div class="cube">
<b class="front">front</b>
<b class="back">back</b>
<b class="top">top</b>
<b class="bottom">bottom</b>
<b class="left">left</b>
<b class="right">right</b>
</div>
</div>