Advertisement
teenagegoths

cube with drag (1)

Sep 11th, 2021 (edited)
1,151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.68 KB | None | 0 0
  1. <!DOCTYPE html><html>
  2. <head>
  3. <script src="https://codepen.io/shshaw/pen/5eb6d4e9bfd78e3911ed9d0d0dfce69b"></script>
  4.  
  5. <style>
  6.  
  7. * {
  8. padding: 0;
  9. margin: 0;
  10. box-sizing: border-box;
  11. }
  12. html {
  13. font-family:Lovely Valentine;
  14. background-size: cover;
  15. }
  16. body {
  17. position: fixed;
  18. background: inherit;
  19. height: 100vh;
  20. width: 1080px;
  21. min-height: 100%;
  22. width: 100%;
  23. overflow: hidden;
  24. font-size: 16px;
  25. display: flex;
  26. align-items: center;
  27. justify-content: center;
  28. }
  29. .viewport {
  30. position: relative;
  31. perspective: 1000px;
  32. perspective-origin: 50% 250px;
  33. transform: scale(0.8, 0.8);
  34.  
  35. }
  36. .cube {
  37. margin: auto;
  38. top: 0;
  39. right: 0;
  40. bottom: 0;
  41. left: 0;
  42. position: relative;
  43. height: 250px;
  44. width: 250px;
  45. transform-style: preserve-3d;
  46. transform: rotateX(136deg) rotateY(1122deg);
  47. }
  48. .cube>div {
  49. overflow: hidden;
  50. position: absolute;
  51. opacity: 1;
  52. height: 250px;
  53. width: 250px;
  54. border: 1px solid black;
  55. touch-callout: none;
  56. user-select: none;
  57. background-color:rgba(255,255,255,0.85);
  58. }
  59. .cube>div>div.cube-image {
  60. width: 250px;
  61. height: 250px;
  62. transform: rotate(180deg);
  63. line-height: 250px;
  64. font-size: 80px;
  65. text-align: center;
  66. color: #000;
  67.  
  68. }
  69. .cube>div>div.cube-image.active {
  70.  
  71. }
  72. .cube>div:hover {
  73. cursor: pointer;
  74. }
  75. .cube>div:active {
  76. cursor: pointer;
  77. }
  78. .cube>div:first-child {
  79. transform: rotateX(90deg) translateZ(125px);
  80. outline: 1px solid transparent;
  81. }
  82. .cube>div:nth-child(2) {
  83. transform: translateZ(125px);
  84. outline: 1px solid transparent;
  85. }
  86. .cube>div:nth-child(3) {
  87. transform: rotateY(90deg) translateZ(125px);
  88. outline: 1px solid transparent;
  89. }
  90. .cube>div:nth-child(4) {
  91. transform: rotateY(180deg) translateZ(125px);
  92. outline: 1px solid transparent;
  93. }
  94. .cube>div:nth-child(5) {
  95. transform: rotateY(-90deg) translateZ(125px);
  96. outline: 1px solid transparent;
  97. }
  98. .cube>div:nth-child(6) {
  99. /* background: URL(""); */
  100. background-repeat: no-repeat;
  101. background-size: 100% auto;
  102. transform: rotateX(-90deg) rotate(180deg) translateZ(125px);
  103. outline: 1px solid transparent;
  104. }
  105. object {
  106. opacity: 0.5;
  107. }
  108. object:hover {
  109. opacity: 1;
  110. }
  111. @media (max-width: 640px) {
  112. .viewport {
  113. transform: scale(0.6, 0.6);
  114. }
  115. }
  116. .threed {
  117. margin-left: auto;
  118. margin-right: auto;
  119. left: 0;
  120. right: 0;
  121. bottom: 6em;
  122. position: absolute;
  123. z-index: 5;
  124. perspective: 1000px;
  125. transform-style: preserve-3d;
  126. }
  127. .circle-me {
  128. font-size: 1em;
  129. letter-spacing: 0.1em;
  130. color: #fff;
  131. opacity: 85%;
  132. text-shadow: 0 0 0.125em #FF007A;
  133. -webkit-text-stroke: 1px #000;
  134. position: relative;
  135. font-size: calc( 1080px / var(--char-total));
  136. width: 65%;
  137. padding: 0.625em;
  138. height: 0px;
  139. margin: auto;
  140. transform-style: preserve-3d;
  141. animation: spin 6s linear infinite;
  142. --speed: calc( 0.6s * var(--char-total));
  143. animation-duration: var(--speed);
  144. }
  145. .char {
  146. position: absolute;
  147. top: 50%;
  148. left: 50%;
  149. line-height: 1;
  150. text-align: center;
  151. width: 1em;
  152. margin-top: -0.5em;
  153. margin-left: -0.5em;
  154. transform-style: preserve-3d;
  155. transform-origin: center;
  156. transform: rotateY(calc(var(--char-index) * 12deg)) translateZ(125px);
  157. }
  158. @keyframes spin {
  159. 0% {
  160. transform: rotateY( 180deg) rotateX( 20deg) rotateY( 360deg);
  161. }
  162. 100% {
  163. transform: rotateY( 180deg) rotateX( 20deg) rotateY( 0deg);
  164. }
  165. }
  166. </style>
  167. <html>
  168. <head>
  169. <title></title>
  170. </head>
  171. <body>
  172. <div class="viewport">
  173. <div class="cube">
  174. <div class="side">
  175. <div class="cube-image">
  176. bottom
  177. </div>
  178. </div>
  179. <div class="side">
  180. <div class="cube-image">
  181. right
  182. </div>
  183. </div>
  184. <div class="side">
  185. <div class="cube-image">
  186. front
  187. </div>
  188. </div>
  189. <div class="side">
  190. <div class="cube-image">
  191. left
  192. </div>
  193. </div>
  194. <div class="side">
  195. <div class="cube-image">
  196. back
  197. </div>
  198. </div>
  199. <div class="side">
  200. <div class="cube-image active">
  201. top
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement