반응형
loading_screen 애니메이션
Code pen을 사용하여 loading_screen 애니메이션을 만들어보았습니다.
HTML
loader 클래스 div 태그 하위에 10개의 자식 ball 클래스인 div 태그를 만들어줍니다.
<div class="loader">
<div class="ball"></div>
<div class="ball"></div>
<div class="ball"></div>
<div class="ball"></div>
<div class="ball"></div>
<div class="ball"></div>
<div class="ball"></div>
<div class="ball"></div>
<div class="ball"></div>
<div class="ball"></div>
</div>
CSS
배경색을 설정하고, loader 클래스의 위치와 애니메이션을 설정합니다.
하위 ball 클래스의 크기와 위치, 배경색을 지정하고 각 nth-child에 애니메이션 지연시간을 설정합니다. @keyframes으로 0%, 100%구간을 설정해주면 끝입니다..!
body {
background-color: rgb(58, 124, 97);
}
.loader {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100px;
height: 100px;
animation: spin .6s linear infinite reverse;
}
.ball {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 100%;
animation: spin 1s infinite ease-in-out;
}
.ball:after {
position: absolute;
content: '';
background-color: rgb(123, 157, 588);
width: 5px;
height: 5px;
border-radius: 100%;
top: 0;
}
.ball:nth-child(2) {
animation-delay: -0.1s;
}
.ball:nth-child(3) {
animation-delay: -0.2s;
}
.ball:nth-child(4) {
animation-delay: -0.3s;
}
.ball:nth-child(5) {
animation-delay: -0.4s;
}
.ball:nth-child(6) {
animation-delay: -0.5s;
}
.ball:nth-child(7) {
animation-delay: -0.6s;
}
.ball:nth-child(8) {
animation-delay: -0.7s;
}
.ball:nth-child(9) {
animation-delay: -0.8s;
}
.ball:nth-child(10) {
animation-delay: -0.9s;
}
@keyframes spin {
0% {
transform: translate(-50%, -50%) rotate(0deg)
}
100% {
transform: translate(-50%, -50%) rotate(360deg)
}
}
반응형
'CSS' 카테고리의 다른 글
MoveEyes 애니메이션 (7) | 2022.09.27 |
---|---|
BoxStretch 애니메이션 (5) | 2022.09.25 |
TextBounce 애니메이션 (8) | 2022.09.22 |
MouseHover 애니메이션 (6) | 2022.09.20 |
Wave 애니메이션 (5) | 2022.09.19 |
댓글