
βοΈ μ λλ©μ΄μ ν¨κ³Ό : 무νλλ‘ νλ 곡 βοΈ
01. μ λλ©μ΄μ ν¨κ³Ό
μ λλ©μ΄μ
(Animation) ν¨κ³Όλ HTML μμμ μ μ©λλ CSS μ€νμΌμ λ€λ₯Έ CSS μ€νμΌλ‘ λΆλλ½κ² λ³νμν΅λλ€.
μ λλ©μ΄μ
μ μ λλ©μ΄μ
μ λνλ΄λ CSS μ€νμΌκ³Ό μ λλ©μ΄μ
μ μ°μλ μ₯λ©΄(sequence)λ₯Ό λνλ΄λ 볡μμ ν€νλ μ(@keyframes)λ€λ‘ μ΄λ£¨μ΄μ§λλ€.
___ μ°Έκ³ νκΈ° ___
`1 @keyframes : CSS μ λλ©μ΄μ
μμ ꡬκ°μ μ νκ³ κ° κ΅¬κ°λ³λ‘ μ΄λ€ μ€νμΌμ μ μ©μν¬μ§ μ ν©λλ€.
02. 무νλ λͺ¨μμΌλ‘ νλ 곡
[1] < div > λ°μ€ λ§λ€κΈ°
div μμ div κ° μλ ꡬ쑰λ₯Ό 5κ° λ§λ€μ΄ μ€λλ€.
<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>
[2] CSS μ€μ νκΈ°
@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: 40px; width: 40px; opacity: 0.6; } .wrapper:nth-of-type(4) > div { animation-delay: 0.3s; height: 40px; width: 40px; opacity: 0.4; } .wrapper:nth-of-type(5) > div { animation-delay: 0.4s; height: 40px; width: 40px; 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 > Animation' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
CSS animation (3) | 2022.09.08 |
---|---|
SVG animation (5) | 2022.09.08 |
μ λλ©μ΄μ λΉκΈλΉκΈ (5) | 2022.08.29 |
μ λλ©μ΄μ λ°μ€ (5) | 2022.08.29 |
μ λλ©μ΄μ - 꼬리 νλλ κ°μμ§ λ§λ€κΈ° (4) | 2022.08.18 |
λκΈ