folding-cube.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <style>
  2. body, html, #<%= globals.id %> {
  3. background: <%= options.background %>;
  4. width: 100%;
  5. height: 100%;
  6. display: flex;
  7. justify-content: center;
  8. align-items: center;
  9. margin: 0;
  10. padding: 0;
  11. }
  12. .sk-folding-cube {
  13. width: 40px;
  14. height: 40px;
  15. position: relative;
  16. -webkit-transform: rotateZ(45deg);
  17. transform: rotateZ(45deg);
  18. }
  19. .sk-folding-cube .sk-cube {
  20. float: left;
  21. width: 50%;
  22. height: 50%;
  23. position: relative;
  24. -webkit-transform: scale(1.1);
  25. -ms-transform: scale(1.1);
  26. transform: scale(1.1);
  27. }
  28. .sk-folding-cube .sk-cube:before {
  29. content: '';
  30. position: absolute;
  31. top: 0;
  32. left: 0;
  33. width: 100%;
  34. height: 100%;
  35. background-color: <%= options.color %>;
  36. -webkit-animation: sk-foldCubeAngle 2.4s infinite linear both;
  37. animation: sk-foldCubeAngle 2.4s infinite linear both;
  38. -webkit-transform-origin: 100% 100%;
  39. -ms-transform-origin: 100% 100%;
  40. transform-origin: 100% 100%;
  41. }
  42. .sk-folding-cube .sk-cube2 {
  43. -webkit-transform: scale(1.1) rotateZ(90deg);
  44. transform: scale(1.1) rotateZ(90deg);
  45. }
  46. .sk-folding-cube .sk-cube3 {
  47. -webkit-transform: scale(1.1) rotateZ(180deg);
  48. transform: scale(1.1) rotateZ(180deg);
  49. }
  50. .sk-folding-cube .sk-cube4 {
  51. -webkit-transform: scale(1.1) rotateZ(270deg);
  52. transform: scale(1.1) rotateZ(270deg);
  53. }
  54. .sk-folding-cube .sk-cube2:before {
  55. -webkit-animation-delay: 0.3s;
  56. animation-delay: 0.3s;
  57. }
  58. .sk-folding-cube .sk-cube3:before {
  59. -webkit-animation-delay: 0.6s;
  60. animation-delay: 0.6s;
  61. }
  62. .sk-folding-cube .sk-cube4:before {
  63. -webkit-animation-delay: 0.9s;
  64. animation-delay: 0.9s;
  65. }
  66. @-webkit-keyframes sk-foldCubeAngle {
  67. 0%, 10% {
  68. -webkit-transform: perspective(140px) rotateX(-180deg);
  69. transform: perspective(140px) rotateX(-180deg);
  70. opacity: 0;
  71. } 25%, 75% {
  72. -webkit-transform: perspective(140px) rotateX(0deg);
  73. transform: perspective(140px) rotateX(0deg);
  74. opacity: 1;
  75. } 90%, 100% {
  76. -webkit-transform: perspective(140px) rotateY(180deg);
  77. transform: perspective(140px) rotateY(180deg);
  78. opacity: 0;
  79. }
  80. }
  81. @keyframes sk-foldCubeAngle {
  82. 0%, 10% {
  83. -webkit-transform: perspective(140px) rotateX(-180deg);
  84. transform: perspective(140px) rotateX(-180deg);
  85. opacity: 0;
  86. } 25%, 75% {
  87. -webkit-transform: perspective(140px) rotateX(0deg);
  88. transform: perspective(140px) rotateX(0deg);
  89. opacity: 1;
  90. } 90%, 100% {
  91. -webkit-transform: perspective(140px) rotateY(180deg);
  92. transform: perspective(140px) rotateY(180deg);
  93. opacity: 0;
  94. }
  95. }
  96. </style>
  97. <div class="sk-folding-cube">
  98. <div class="sk-cube1 sk-cube"></div>
  99. <div class="sk-cube2 sk-cube"></div>
  100. <div class="sk-cube4 sk-cube"></div>
  101. <div class="sk-cube3 sk-cube"></div>
  102. </div>
  103. <%= options.dev ? '<!-- http://tobiasahlin.com/spinkit -->' : '' %>