본문 바로가기
CSS

간단한 애니메이션 04

by 코딩대원 2022. 9. 19.

간단한 애니메이션 04

간단한 애니메이션 만들기 네번째 시간입니다.
웨이브 애니메이션을 만들어보겠습니다.


01. HTML

Pug를 컴파일시켰습니다. 너무 길어서 접어놓겠습니다.

결과보기
{
    <div class="circle-wrap">
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
    <div class="row">
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
      <div class="circle"></div>
    </div>
  </div>
}

02. CSS

SCSS를 컴파일 시켰습니다.

{
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100vh;
        background-image: linear-gradient(45deg, #00DBDE 0%, #FC00FF 100%);
      }
      
      .row {
        display: flex;
      }
      .row .circle {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        margin: 5px 10px;
        background: #fff;
        transform-origin: top center;
        animation: spin 1s linear infinite;
      }
      @keyframes spin {
        0% {
          transform: scale(1.1) rotate(0deg);
        }
        50% {
          transform: scale(0.2) rotate(180deg);
        }
        100% {
          transform: scale(1.1) rotate(360deg);
        }
      }
      
      .row:nth-child(1) .circle {
        animation-delay: 100ms;
      }
      
      .row:nth-child(2) .circle {
        animation-delay: 200ms;
      }
      
      .row:nth-child(3) .circle {
        animation-delay: 300ms;
      }
      
      .row:nth-child(4) .circle {
        animation-delay: 400ms;
      }
      
      .row:nth-child(5) .circle {
        animation-delay: 500ms;
      }
      
      .row:nth-child(6) .circle {
        animation-delay: 600ms;
      }
      
      .row:nth-child(7) .circle {
        animation-delay: 700ms;
      }
      
      .row:nth-child(8) .circle {
        animation-delay: 800ms;
      }
      
      .row:nth-child(9) .circle {
        animation-delay: 900ms;
      }
      
      .row:nth-child(10) .circle {
        animation-delay: 1000ms;
      }
      
      .row:nth-child(11) .circle {
        animation-delay: 1100ms;
      }
      
      .row:nth-child(12) .circle {
        animation-delay: 1200ms;
      }
}

03. 결과물

'CSS' 카테고리의 다른 글

간단한 애니메이션 06  (4) 2022.09.21
간단한 애니메이션 05  (3) 2022.09.20
애니메이션 속성 정리 / 예제  (5) 2022.09.08
SVG 텍스트 애니메이션  (5) 2022.09.08
Walking 애니메이션  (5) 2022.09.07

댓글


HTML
CSS

JAVASCRIPT

자세히 보기