본문 바로가기
CSS

Wave 애니메이션

by 코터틀 2022. 9. 19.
반응형

웨이브 애니메이션

Code pen을 사용하여 꿀렁이는 웨이브 애니메이션을 만들어봤습니다.


HTML

html을 조금 더 세련되게 쓸 수 있는 템플릿 언어 pug를 사용하였습니다.

div.circle-wrap
- for (var x =1; x <= 12; x++)
    div.row
    - for (var y = 1; y <= 12; y++)
        div.circle

CSS

SCSS를 사용했습니다. mixin은 여러 여러 컴포넌트 간에 공통으로 사용하고 있는 로직, 기능들을 재사용하는 방법 정도로만 알고계시면 될거같습니다.

@mixin center {
    display: flex;
    align-items: center;
    justify-content: center;
}

body {
    @include center;
    height: 100vh;
    background-image: linear-gradient(45deg, #00dbde 0%, #fc00ff 100%)
}

.row {
        display: flex;
}

.circle {
    width: 10px;
    height: 10px;
    background: #fff;
    margin: 5px 10px;
    border-radius: 50%;
    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} */
@for $i from 1 through 12 {
    .row:nth-child(#{$i}) .circle {animation-delay: 100ms * $i}
}
반응형

'CSS' 카테고리의 다른 글

TextBounce 애니메이션  (8) 2022.09.22
MouseHover 애니메이션  (6) 2022.09.20
Walking 애니메이션  (12) 2022.09.07
Text 애니메이션  (9) 2022.09.07
SVG Animation  (12) 2022.09.07

댓글


광고 준비중입니다.