Created
June 18, 2013 08:56
-
-
Save clanceyp/5803769 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 spinningH { | |
| from { | |
| transform: rotateX(0deg) rotateY(0deg); | |
| } | |
| to{ | |
| transform: rotateX(360deg) rotateY(360deg); | |
| } | |
| } | |
| body { | |
| background-color:lightgrey; | |
| margin-top: 100px; | |
| } | |
| div.container { | |
| perspective: 1000px; | |
| perspective-origin: 50% 50%; | |
| } | |
| div.animate { | |
| animation: spinningH 6s infinite 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":"javascript"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment