1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <style type="text/css"> #triangle-box{ position: absolute; margin-left: 200px; margin-top: 200px; } .triangle{ animation: rot 30s linear infinite; } @keyframes rot{ 0%{ transform:rotateX(-14deg)rotateY(0deg)rotateZ(111deg) } 100%{ transform:rotateX(-14deg)rotateY(360deg)rotateZ(111deg) } } .triangle, .triangle *, .triangle :before{ position: absolute; margin-top: 40%; top: 50%; left: 50%; perspective: 1000px; transform-style: preserve-3d; } #triangle-box, .face{ height: 160px; width: 160px; } .face{ border-top: solid 4px #000; border-left: solid 4px #000; margin: -80px; transform: rotate(60deg)skewX(30deg)scaleY(.86603); } .face:before{ box-sizing: border-box; margin: -65px 0 0 -84px; width: 160px; height: 136px; border-bottom: solid 4px #000; transform: scaleY(1.16)skewX(-30deg)rotate(-60deg)translateY(-50%); content:''; } .face:nth-child(1){ transform: rotateX(-90deg)translateY(46px)rotate(60deg)skewX(30deg)scaleY(.86603) } .face:nth-child(2){ transform: rotateY(60deg)translateZ(46px)rotateX(19.47122deg)rotate(60deg)skewX(30deg)scaleY(.86603) } .face:nth-child(3){ transform: rotateY(180deg)translateZ(46px)rotateX(19.47122deg)rotate(60deg)skewX(30deg)scaleY(.86603) } .face:nth-child(4){ transform: rotateY(300deg)translateZ(46px)rotateX(19.47122deg)rotate(60deg)skewX(30deg)scaleY(.86603) } </style> </head> <body> <div id="triangle-box"> <div class="triangle"> <div class="face"></div> <div class="face"></div> <div class="face"></div> <div class="face"></div> </div> </div> </body>
|