Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <!DOCTYPE html>
  2. html(lang="en")
  3. head
  4. meta(charset="UTF-8")
  5. title Document
  6. link(rel="stylesheet", href="style/style.css")
  7. body
  8. #box
  9. .box
  10. .box__bottom.js__bottom
  11. .box__top.js__top
  12. .box__left.js__left
  13. .box__right.js__right
  14. .box__back.js__back
  15. .box__front.js__front
  16.  
  17. body
  18. background-color: #222
  19. color: #FFF
  20. display: flex
  21. justify-content: center
  22.  
  23. #box
  24. width: 100px
  25. margin: 50px
  26. pointer-events: none
  27.  
  28. .box
  29. width: 100px
  30. height: 100px
  31. margin: 30px auto
  32. position: relative
  33. div
  34. position: absolute
  35. text-align: center
  36. left: 0
  37. top: 0
  38. line-height: 100px
  39. font-weight: bold
  40. font-size: 40px
  41. width: 100px
  42. height: 100px
  43. color: #111
  44. &__front
  45. background-color: black
  46.  
  47. &__back
  48. background-color: red
  49.  
  50. &__right
  51. background-color: blue
  52.  
  53. &__left
  54. background-color: yellow
  55.  
  56. var dur = 6,
  57. e = Linear.easeNone,
  58. tlMaster = new TimelineMax({paused:true});
  59.  
  60. TweenMax.set(".box", {
  61. transformStyle: "preserve-3d"
  62. });
  63. TweenMax.set(".box > div", {
  64. transformStyle: "preserve-3d",
  65. transformOrigin: "50% 50% -50px",
  66. transformPerspective: 1000
  67. });
  68. TweenMax.set(".js__back", {
  69. rotationY: 270
  70. });
  71. TweenMax.set(".js__right", {
  72. rotationY: 180
  73. });
  74. TweenMax.set(".js__left", {
  75. rotationY: 90
  76. });
  77. TweenMax.set(".js__top", {
  78. rotationX: 90
  79. });
  80. TweenMax.set(".js__bottom", {
  81. rotationX: 270
  82. });
  83.  
  84. function facesInner(){
  85.  
  86. var tlFacesInner = new TimelineMax({
  87. repeat: -1
  88. });
  89. tlFacesInner
  90. .to(".js__front", dur, {
  91. rotationY: '+=360',
  92. ease: e
  93. }, 0)
  94. .to(".js__back", dur, {
  95. rotationY: '+=360',
  96. ease: e
  97. }, 0)
  98. .to(".js__top", dur, {
  99. rotationY: '+=360',
  100. ease: e
  101. }, 0)
  102. .to(".js__bottom", dur, {
  103. rotationY: '+=360',
  104. ease: e
  105. }, 0)
  106. .to(".js__left", dur, {
  107. rotationY: '+=360',
  108. ease: e
  109. }, 0)
  110. .to(".js__right", dur, {
  111. rotationY: '+=360',
  112. ease: e
  113. }, 0);
  114.  
  115. return tlFacesInner;
  116. }
  117.  
  118. function faces(){
  119.  
  120. var tlFaces = new TimelineMax({
  121. repeat: -1
  122. });
  123. tlFaces
  124. return tlFaces;
  125. }
  126.  
  127. window.requestAnimationFrame(function(){
  128.  
  129. tlMaster
  130. .add(facesInner(), 0)
  131. .add(faces(), 0)
  132. .progress(1).progress(0)
  133. .play();
  134.  
  135. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement