Advertisement
Hatkat

SASS cube rubick

Dec 18th, 2023
762
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 2.54 KB | None | 0 0
  1. $colors:(
  2.     1: #ffc400,
  3.     2: #FFFFFF,
  4.     3: #00FFFF,
  5.     4: #ff004c,
  6.     5: #00ff37,
  7.     6: #fffb00,
  8. );
  9. $speed: 3;
  10.  
  11. body{
  12.     background: radial-gradient(
  13.         rgb(24, 1, 32) 25%,
  14.         rgba(0, 0, 0, 1) 100%
  15.     );
  16.     height: 100vh;
  17.     display: flex;
  18.     justify-content: center;
  19.     align-items: center;
  20.     flex-direction: column;
  21. }
  22.  
  23. .contain{
  24.     width: 400px;
  25.     height: 450px;
  26.     perspective: 1000px;
  27.     padding: 5px;
  28.     position: relative;
  29.     .contain-in{
  30.         width: 100%;
  31.         height: 100%;
  32.         transform-style: preserve-3d;
  33.         transition: all $speed * 1s;
  34.         display: flex;
  35.         justify-content: center;
  36.         align-items: center;
  37.         .cube{
  38.             background-color: #000;
  39.             $size-cube: 200;
  40.             $size-m-cube: ($size-cube / 2);
  41.             position: absolute;
  42.             width: $size-cube * 1px;
  43.             height: $size-cube * 1px;
  44.             margin: 0px auto;
  45.             border-radius: 10px;
  46.             &:nth-child(1){
  47.                 transform: translateZ(-$size-m-cube * 1px);
  48.             }
  49.             &:nth-child(2){
  50.                 transform: rotateY(90deg) translateZ(-$size-m-cube * 1px);
  51.             }
  52.             &:nth-child(3){
  53.                 transform: rotateY(90deg) translateZ($size-m-cube * 1px);
  54.             }
  55.             &:nth-child(4){
  56.                 transform: translateZ($size-m-cube * 1px);
  57.             }
  58.             &:nth-child(5){
  59.                 transform: rotateX(90deg) translateZ(-$size-m-cube * 1px);
  60.             }
  61.             &:nth-child(6){
  62.                 transform: rotateX(90deg) translateZ($size-m-cube * 1px);
  63.             }
  64.  
  65.             display: grid;
  66.             grid-template-rows: repeat(3, 1fr);
  67.             grid-template-columns: repeat(3, 1fr);
  68.  
  69.         }
  70.  
  71.         &:hover{
  72.             transform: rotateY(360deg) rotateX(355deg);
  73.         }
  74.     }
  75.  
  76.     $cont-color: 1;
  77.     @for $i from 1 through 6{
  78.         .cube-out-#{$i}{
  79.             .cube-{
  80.                 @for $i from 1 through 9{
  81.                     &#{$i}{
  82.                         background-color: #000;
  83.                         width: 95%;
  84.                         height: 95%;
  85.                         border-radius: 12px;
  86.                         border: 3px solid map-get($colors, $cont-color);
  87.                         box-shadow: 0px 0px 10px map-get($colors, $cont-color) inset;
  88.                        
  89.                     }
  90.                 }
  91.             }
  92.         }
  93.         $cont-color: $cont-color + 1;
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement