비전공자 개발일기

3D Animation Effect 본문

HTML _CSS

3D Animation Effect

HiroDaegu 2022. 8. 8. 00:26
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>3D ANIMATION EFFECT</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <div class="conatiner">
    <span style="--i:1;"></span>
    <span style="--i:2;"></span>
    <span style="--i:3;"></span>
    <span style="--i:4;"></span>
    <span style="--i:5;"></span>
    <span style="--i:6;"></span>
  </div>
</body>
</html>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background: radial-gradient(#785DFF, #0081E8);
  display: flex;
  justify-content: center;
  align-items: center;
}

.conatiner {
  position: relative;
  width: 150px;
  height: 150px;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;
  transform: perspective(500px) rotateX(135deg);
}

.conatiner span {
  position: absolute;
  display: flex;
  border: 15px solid #FFF;
  border-radius: 50%;
  animation:  animate 6s ease-in-out infinite;
  box-shadow: 0 10px 0 #EFEBED, inset 0 10px 0 #ECECEC;
  animation-delay: calc(-1s * var(--i));
}

@keyframes animate {
  0% {
    transform: translateZ(-100px);
    width: 100%;
    height: 100%;
  }
  25% {
    transform: translateZ(100px);
    width: 100%;
    height: 100%;
  }
  50% {
    transform: translateZ(100px);
    width: 15%;
    height: 15%;
  }
  75% {
    transform: translateZ(-100px);
    width: 15%;
    height: 15%;
  }
  100% {
    transform: translateZ(100px);
    width: 100%;
    height: 100%;
  }
}
728x90
LIST

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

Simple Countdown  (0) 2022.08.10
404 Error Page  (0) 2022.08.09
Scroll To Top  (0) 2022.08.06
Text Animation  (0) 2022.08.05
Sidebar Menu  (0) 2022.08.04