코딩 공부/애니메이션
애니메이션 만들기
천서리
2023. 3. 24. 11:58
반응형
HTML
<div class="watch__face">
<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>
CSS
body {
background-color: #000;
align-items: center;
justify-content: center;
display: flex;
height: 100vh;
}
.watch__face {
animation: summer 3s cubic-bezier(0.5, 0, 0.5, 1) alternate infinite;
width: 125px;
height: 125px;
}
.circle {
width: 125px;
height: 125px;
border-radius: 50%;
position: absolute;
mix-blend-mode: screen;
}
.circle:nth-child(odd) {
background-color: #90e0ef;
}
.circle:nth-child(even) {
background-color: #caf0f8;
}
.circle:nth-child(1) {
animation: circle1 3s ease alternate infinite;
}
.circle:nth-child(2) {
animation: circle2 3s ease alternate infinite;
}
.circle:nth-child(3) {
animation: circle3 3s ease alternate infinite;
}
.circle:nth-child(4) {
animation: circle4 3s ease alternate infinite;
}
.circle:nth-child(5) {
animation: circle5 3s ease alternate infinite;
}
.circle:nth-child(6) {
animation: circle6 3s ease alternate infinite;
}
@keyframes summer {
0% {
transform: scale(0.15) rotate(180deg);
}
100% {
transform: scale(1);
}
}
@keyframes circle1 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(35px, 50px);
}
}
@keyframes circle2 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(-35px, -50px);
}
}
@keyframes circle3 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(35px, -50px);
}
}
@keyframes circle4 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(-35px, 50px);
}
}
@keyframes circle5 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(60px, 0px);
}
}
@keyframes circle6 {
0% {
transform: translate(0, 0);
}
100% {
transform: translate(-60px, 0px);
}
}
반응형