Created
June 21, 2013 12:44
-
-
Save clanceyp/5830907 to your computer and use it in GitHub Desktop.
Untitled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @keyframes go { | |
| 0% { | |
| transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale3d(1,1,1); | |
| } | |
| 100% { | |
| transform: rotateX(0deg) rotateY(90deg) rotateZ(0deg) scale3d(1,1,1); | |
| } | |
| } | |
| @keyframes spin { | |
| 0% { | |
| transform: rotateX(0deg) rotateY(0deg) scale3d(1,1,1); | |
| } | |
| 50% { | |
| transform: rotateX(180deg) rotateY(180deg) scale3d(0.3,0.3,0.3); | |
| } | |
| 100% { | |
| transform: rotateX(360deg) rotateY(360deg) scale3d(1,1,1); | |
| } | |
| } | |
| body { | |
| background-color:lightgrey; | |
| margin-top: 100px; | |
| } | |
| div.container { | |
| perspective: 1000px; | |
| perspective-origin: 50% 50%; | |
| } | |
| div.animate { | |
| animation: spin 3s 1 linear; | |
| } | |
| body.off div.animate { | |
| animation: none; | |
| } | |
| div.cube { | |
| height: 400px; | |
| margin: 0 auto; | |
| position: relative; | |
| transform-style: preserve-3d; | |
| transition: transform 2s linear; | |
| width: 400px; | |
| } | |
| div.cube div.face { | |
| background-position:center center; | |
| height: 360px; | |
| opacity: 1; | |
| padding: 20px; | |
| position: absolute; | |
| transform: translateZ(200px); | |
| width: 360px; | |
| } | |
| div.cube div.face:nth-child(1) { | |
| background-color : red; | |
| } | |
| div.cube div.face:nth-child(2) { | |
| background-color : blue; | |
| transform : rotateY(90deg) translateZ(200px); | |
| } | |
| div.cube div.face:nth-child(3) { | |
| background-color : green; | |
| transform : rotateY(180deg) translateZ(200px); | |
| } | |
| div.cube div.face:nth-child(4) { | |
| background-color : yellow; | |
| transform : rotateY(-90deg) translateZ(200px); | |
| } | |
| div.cube div.face:nth-child(5) { | |
| background-color : purple; | |
| transform : rotateX(-90deg) translateZ(200px) rotate(180deg); | |
| } | |
| div.cube div.face:nth-child(6) { | |
| background-color : silver; | |
| transform : rotateX(90deg) translateZ(200px); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <button class="toggle">toggle</button> | |
| <div class="container"> | |
| <div class="cube animate"> | |
| <div class="face"></div> | |
| <div class="face"></div> | |
| <div class="face"></div> | |
| <div class="face"></div> | |
| <div class="face"></div> | |
| <div class="face"></div> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var bttn = document.getElementsByTagName('button')[0], | |
| body = document.getElementsByTagName('body')[0]; | |
| bttn.addEventListener('click',function(){ | |
| if (body.className.match('off')){ | |
| body.className = ''; | |
| } else { | |
| body.className = 'off'; | |
| } | |
| },false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"view":"split","fontsize":"100","seethrough":"1","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment