비전공자 개발일기

Lighting Loader 본문

HTML _CSS

Lighting Loader

HiroDaegu 2022. 9. 2. 00:23
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>LIGHTING LOADER</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <div class="box">
    <div class="loader">
      <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>
      <span style="--i:7;"></span>
      <span style="--i:8;"></span>
      <span style="--i:9;"></span>
      <span style="--i:10;"></span>
      <span style="--i:11;"></span>
      <span style="--i:12;"></span>
    </div>
  </div>
  <h3>THIS is CSS's <b>Magic</b></h3>
</body>
</html>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #222;
}

.loader {
  position: relative;
  width: 150px;
  height: 150px;
  animation: animate 24s steps(12) infinite;
}

@keyframes animate {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}

h3 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: .85em;
  font-weight: 300;
  color: rgba(255, 255, 255, .25);
  text-transform: uppercase;
}

h3 b {
  color: #FFF;
  font-weight: 500;
  text-shadow: 0 0 10px #FFF, 0 0 20px #FFF, 0 0 30px #FFF, 0 0 40px #FFF, 0 0 50px #FFF;
}

.loader span {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(calc(30deg * var(--i)));
}

.loader span::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background-color: rgba(255, 255, 255, .15);
}

.loader span:nth-child(3n + 3):before {
  background-color: #FFF;
  box-shadow: 0 0 10px #FFF, 0 0 20px #FFF, 0 0 30px #FFF, 0 0 40px #FFF, 0 0 50px #FFF;
  animation: animateSquare 2s linear infinite;
  transform-origin: 75px;
}

@keyframes animateSquare {
  0%, 25% {
    transform: rotate(0);
  }
  75%, 90%, 100% {
    transform: rotate(180deg);
  }
}
728x90
LIST

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

Wave BG Button  (0) 2022.09.04
Tabs Using  (0) 2022.09.03
Emotion Animation  (0) 2022.09.01
CSS Animated Swipe  (0) 2022.08.31
Checkbox Custom  (0) 2022.08.30