๋ฐ์ํ
๊ณต์ด ํ๋ ์ ๋๋ฉ์ด์ ๋ง๋ค๊ธฐโฝ
์ด๋ฒ ํฌ์คํ ์์๋ ๊ณต์ด ์ ์ ์์ด๐คช๐คช๐คช ๋ฌดํ์ผ๋ก ํ๋ ์ ๋๋ฉ์ด์ ์ ๋ง๋ค์ด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค.
HTML ์ฝ๋
<div class="wrapper">
<div></div>
</div>
<div class="wrapper">
<div></div>
</div>
<div class="wrapper">
<div></div>
</div>
<div class="wrapper">
<div></div>
</div>
<div class="wrapper">
<div></div>
</div>
CSS ์ฝ๋
linear-gradient๋ก ๊ทธ๋ผ๋์ธํธ ํจ๊ณผ ๋ฐฐ๊ฒฝ์ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ position ์์ฑ๊ณผ animation, @keyframes ๋ฑ์ ์ ํ์ฉํ์ฌ ์ ๋๋ฉ์ด์ ์ ์์ฑ์ํฌ ์ ์๋ค.
* {
box-sizing: border-box;
}
body {
background: linear-gradient(to top, #a18cd1 0%, #fbc2eb 100%);
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
padding: 0;
}
.wrapper {
position: absolute;
animation: x 1s ease-in-out alternate infinite 0s both;
}
.wrapper:nth-of-type(2) {
animation-delay: 0.1s;
}
.wrapper:nth-of-type(3) {
animation-delay: 0.2s
}
.wrapper:nth-of-type(4) {
animation-delay: 0.3s
}
.wrapper:nth-of-type(5) {
animation-delay: 0.4s
}
.wrapper > div {
width: 50px;
height: 50px;
background-color: #fff;
border-radius: 100%;
margin: 40px;
animation: y 1s linear infinite 0s both;
}
.wrapper:nth-of-type(2) > div {
animation-delay: 0.1s;
height: 40px;
width: 40px;
opacity: 0.8;
}
.wrapper:nth-of-type(3) > div {
animation-delay: 0.2s;
height: 30px;
width: 30px;
opacity: 0.6;
}
.wrapper:nth-of-type(4) > div {
animation-delay: 0.3s;
height: 20px;
width: 20px;
opacity: 0.4;
}
.wrapper:nth-of-type(5) > div {
animation-delay: 0.4s;
height: 10px;
width: 10px;
opacity: 0.2;
}
@keyframes x {
0% {
transform:translatex(-100px);
}
100% {
transform:translatex(100px);
}
}
@keyframes y {
25% {
transform:translatey(-50px);
}
0%,50%,100% {
transform:translatey(0);
}
75% {
transform:translatey(50px);
}
}
๊ฒฐ๊ณผ๋ฌผ
์ ์ ์์ด ํ๋ ๊ณต ์ ๋๋ฉ์ด์ ์์ฑ์ ๋๋ค~๐คช ์์ด๊ณ ์ ์ ์๋ค^^
๋ฐ์ํ
'CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CSS] SVG๋? - ๋ํยท์ ๋๋ฉ์ด์ ๋ง๋ค๊ธฐ (8) | 2022.09.07 |
---|---|
[CSS] ์ ๋๋ฉ์ด์ ์ข ๋ฅ์ ์ฌ์ฉ ๋ฐฉ๋ฒ ์ด์ ๋ฆฌ (7) | 2022.09.07 |
[CSS] ์ ์ฌ๊ฐํ์ด ํ์ ํ๋ ์ ๋๋ฉ์ด์ ๋ง๋ค๊ธฐ (5) | 2022.08.29 |
[CSS] ์ 2๊ฐ๊ฐ ์๊ณ๋ฐฉํฅ์ผ๋ก ํ์ ํ๋ ์ ๋๋ฉ์ด์ ๋ง๋ค๊ธฐ (4) | 2022.08.29 |
[CSS] ์์ ์จ๊ธฐ๋ ๋ฐฉ๋ฒ ์์๋ณด๊ธฐ (9) | 2022.08.25 |
๋๊ธ