Skip to content

Instantly share code, notes, and snippets.

@simudream
Created November 27, 2014 00:34
Show Gist options
  • Save simudream/79344f37164b991a818c to your computer and use it in GitHub Desktop.
Save simudream/79344f37164b991a818c to your computer and use it in GitHub Desktop.
XYZ
<div class="xyz-container">
<div class="plane x"></div>
<div class="plane y"></div>
<div class="plane z"></div>
</div>
.xyz-container {
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
margin: auto;
width: 100px;
height: 100px;
-webkit-perspective-origin: 150px -50px;
-webkit-perspective: 200px;
}
.plane {
position: absolute;
top: 0;
left: 0;
height: 100px;
width: 100px;
-webkit-transition: 1s;
}
.plane:before {
content: '';
position: absolute;
width: 1px;
height: 100px;
top: 0;
left: 50px;
background-color: rgba(255,255,255,0.5);
}
.x {
background-color: rgba(0,0,255,0.5);
}
.xyz-container:hover .x {
-webkit-transform: rotateX(90deg);
}
.y {
background-color: rgba(255,0,0,0.5);
}
.xyz-container:hover .y {
-webkit-transform: rotateY(90deg);
}
.z {
background-color: rgba(0,255,0,0.5);
}
.xyz-container:hover .z {
-webkit-transform: rotateZ(90deg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment