비전공자 개발일기

Cubic Spinner 본문

HTML _CSS

Cubic Spinner

HiroDaegu 2022. 7. 10. 00:37
728x90
SMALL

 

<!DOCTYPE html>
<html lang="ko">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CUBE SPINNER</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <div class="container">
    <div class="cubic">
      <div class="surface one">1</div>
      <div class="surface two">4</div>
      <div class="surface three">3</div>
      <div class="surface four">6</div>
      <div class="surface five">5</div>
      <div class="surface six">2</div>
    </div>
  </div>
</body>
</html>
body {
  margin: 12% 40%;
  background-color: #CCC;
}

.container {
  width: 300px;
  height: 300px;
  position: relative;
  perspective: 1000px;
}

.cubic {
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
  transform: translateZ(-200px) rotateZ(180deg) rotateX(45deg);
  animation: spin 3s infinite linear;
}

.cubic .surface {
  width: 100%;
  height: 100%;
  font-size: 130px;
  font-weight: 700;
  color: #FFF;
  display: block;
  position: absolute;
  line-height: 300px;
  background-color: #004080;
  text-align: center;
  backface-visibility: hidden;
}

.cubic .one {transform: rotateY(90deg) translateZ(150px);}
.cubic .two {transform: rotateX(180deg) translateZ(150px);}
.cubic .three {transform: rotateX(360deg) translateZ(150px);}
.cubic .four {transform: rotateY(-90deg) translateZ(150px);}
.cubic .five {transform: rotateX(90deg) translateZ(150px);}
.cubic .six {transform: rotateX(-90deg) translateZ(150px);}

@keyframes spin {
  0% {transform: translateZ(-100px) rotateY(360deg) rotateZ(0deg) rotateX(45deg);}
  50% {transform: translateZ(-100px) rotateY(180deg) rotateZ(180deg) rotateX(45deg);}
  100% {transform: translateZ(-100px) rotateY(0deg) rotateZ(360deg) rotateX(45deg);}
}
728x90
LIST

'HTML _CSS' 카테고리의 다른 글

Youtube Clone  (0) 2022.07.13
Parallax Effect  (0) 2022.07.12
CSS Wave  (0) 2022.07.04
Google Search Clone  (0) 2022.07.01
Arrow Magic Menu Indicator  (0) 2022.06.28