λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
CSS

[CSS] CSS μ• λ‹ˆλ©”μ΄μ…˜μ— λŒ€ν•΄ μ•Œμ•„λ³΄μž!

by _토맀토 2022. 9. 8.
728x90

CSS : μ• λ‹ˆλ©”μ΄μ…˜(animation)

이번 μ‹œκ°„μ—λŠ” CSS둜 ν‘œν˜„ν•  수 μžˆλŠ” μ• λ‹ˆλ©”μ΄μ…˜ 속성듀에 λŒ€ν•΄ μ•Œμ•„λ³΄κ² μŠ΅λ‹ˆλ‹€! πŸ˜„


#1. animation μ†μ„±μ˜ κΈ°λ³Έ ν‘œν˜„

animation : name | duration | timing-function | delay | iteration | direction | fill-mode | play-state

μ• λ‹ˆλ©”μ΄μ…˜: 이름 | μ§€μ†μ‹œκ°„ | 타이밍 κΈ°λŠ₯ | μ§€μ—°μ‹œκ°„ | λ°©ν–₯ | μ±„μš°κΈ° λͺ¨λ“œ | μž¬μƒ μƒνƒœ


#2. animation의 μ’…λ₯˜

λ‹€μŒμ€ animation의 μ’…λ₯˜μž…λ‹ˆλ‹€~! ν‘œλ₯Ό 보며 ν•¨κ»˜ μ•Œμ•„λ΄…μ‹œλ‹€!

μ’…λ₯˜ μ˜ˆμ‹œ
animation-name @keyframe에 μ§€μ •λœ 이름을 μ„€μ •ν•©λ‹ˆλ‹€.
animation-duration μ• λ‹ˆλ©”μ΄μ…˜μ΄ μ‹€ν–‰λ˜λŠ” μ‹œκ°„μ„ μ„€μ •ν•©λ‹ˆλ‹€.
animation-timing-function μ• λ‹ˆλ©”μ΄μ…˜ ν‚€ν”„λ ˆμž„ μ›€μ§μž„μ„ μ„€μ •ν•©λ‹ˆλ‹€.
animation-delay μ• λ‹ˆλ©”μ΄μ…˜μ΄ μ‹œμž‘λ˜κΈ° μ „κΉŒμ§€ μ‹œκ°„μ„ μ„€μ •ν•©λ‹ˆλ‹€.
animation-iteration μ• λ‹ˆλ©”μ΄μ…˜ 반볡 횟수λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€.
animation-derection μ• λ‹ˆλ©”μ΄μ…˜ λ°©ν–₯을 μ„€μ •ν•©λ‹ˆλ‹€.
animation-fill-mode μ• λ‹ˆλ©”μ΄μ…˜ λλ‚˜κ³  λ‚œ λ’€ μ–΄λ–€ 값을 μ μš©ν• μ§€ μ„€μ •ν•©λ‹ˆλ‹€.
animation-play-state μ• λ‹ˆλ©”μ΄μ…˜ μ‹€ν–‰ μƒνƒœλ₯Ό μ„€μ •ν•©λ‹ˆλ‹€.

#3. transtion μ’…λ₯˜

λ‹€μŒμ€ animation의 transtion μ’…λ₯˜μž…λ‹ˆλ‹€~! ν‘œλ₯Ό 보며 ν•¨κ»˜ μ•Œμ•„λ΄…μ‹œλ‹€!

μ’…λ₯˜ μ˜ˆμ‹œ
transition-property νŠΈλ Œμ§€μ…˜μ„ μ μš©ν•  CSS 속성 λŒ€μƒμ„ μ„€μ •ν•©λ‹ˆλ‹€.
transition-druation νŠΈλ Œμ§€μ…˜ μž‘λ™μ‹œκ°„μ„ μ„€μ •ν•©λ‹ˆλ‹€.
transition-timing-function νŠΈλ Œμ§€μ…˜ μ›€μ§μž„ 효과λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€.
transition-delay νŠΈλ Œμ§€μ…˜μ΄ μ‹œμž‘λ˜κΈ° μ „κΉŒμ§€ μ‹œκ°„μ„ μ„€μ •ν•©λ‹ˆλ‹€.

#4. timing-function μ’…λ₯˜

λ‹€μŒμ€ animation의 transtion μ’…λ₯˜μž…λ‹ˆλ‹€~! ν‘œλ₯Ό 보며 ν•¨κ»˜ μ•Œμ•„λ΄…μ‹œλ‹€!

μ’…λ₯˜ μ˜ˆμ‹œ
transition-property νŠΈλ Œμ§€μ…˜μ„ μ μš©ν•  CSS 속성 λŒ€μƒμ„ μ„€μ •ν•©λ‹ˆλ‹€.
transition-druation νŠΈλ Œμ§€μ…˜ μž‘λ™μ‹œκ°„μ„ μ„€μ •ν•©λ‹ˆλ‹€.
transition-timing-function νŠΈλ Œμ§€μ…˜ μ›€μ§μž„ 효과λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€.
transition-delay νŠΈλ Œμ§€μ…˜μ΄ μ‹œμž‘λ˜κΈ° μ „κΉŒμ§€ μ‹œκ°„μ„ μ„€μ •ν•©λ‹ˆλ‹€.

#4-2. timing-function μ˜ˆμ‹œ

λ‹€μŒμ€ animation의 transtion μ˜ˆμ‹œ μž…λ‹ˆλ‹€~! μ• λ‹ˆλ©”μ΄μ…˜κ³Ό μ½”λ“œλ₯Ό 보며 각각 μ–΄λ–€ νš¨κ³ΌμΈμ§€ μ•Œμ•„λ΄…μ‹œλ‹€!

πŸ“– timing-function

linear
ease
ease-in
ease-out
ease-in-out
πŸ’‘ CSS μ½”λ“œ 보기
.timing1.show {animation: move 2s 1 linear;}
.timing2.show {animation: move 2s 1 ease;}
.timing3.show {animation: move 2s 1 ease-in;}
.timing4.show {animation: move 2s 1 ease-out;}
.timing5.show {animation: move 2s 1 ease-in-out;}

@keyframes move {
0% {left: 0%;}
50% {left: 100%;}
100% {left: 0%;}
}

πŸ“– timing-function

step-start
step-end
steps(4, start)
steps(4, end)
steps(10, start)
steps(10, start)
πŸ’‘ CSS μ½”λ“œ 보기
.timing6.show {animation: move 4s 1 step-start;}
.timing7.show {animation: move 4s 1 step-end;}
.timing8.show {animation: move 4s 1 steps(4, start);}
.timing9.show {animation: move 4s 1 steps(4, end);}
.timing10.show {animation: move 4s 1 steps(10, start);}
.timing11.show {animation: move 4s 1 steps(10, end);}

πŸ“– cubic-bezier

timing12
timing13
timing14
timing15
timing16
πŸ’‘ CSS μ½”λ“œ 보기
.timing12.show {animation: move 3s 2 cubic-bezier(0,.71,0,1);}
.timing13.show {animation: move 3s 2 cubic-bezier(0,.71,1,-0.28);}
.timing14.show {animation: move 3s 2 cubic-bezier(1,-0.52,1,-0.28);}
.timing15.show {animation: move 3s 2 cubic-bezier(1,.02,0,1.01);}
.timing16.show {animation: move 3s 2 cubic-bezier(.33,2.04,1,2.05);}

πŸ“– animation-delay

timing17
timing18
timing19
timing20
πŸ’‘ CSS μ½”λ“œ 보기
.timing17.show {animation: move 3s 0.1s 2 ease;}
.timing18.show {animation: move 3s 0.2s 2 ease;}
.timing19.show {animation: move 3s 0.3s 2 ease;}
.timing20.show {animation: move 3s 0.4s 2 ease;}

πŸ“– animation-delay

timing21
timing22
timing23
timing24
πŸ’‘ CSS μ½”λ“œ 보기
.timing21.show {animation: move 1s 1 ease;}
.timing22.show {animation: move 1s 2 ease;}
.timing23.show {animation: move 1s 3 ease;}
.timing24.show {animation: move 1s infinite ease;}

πŸ“– animation-direction

timing25
πŸ’‘ CSS μ½”λ“œ 보기
.timing25.normal {animation: move2 4s 5 ease normal;}
.timing26.reverse {animation: move2 4s 5 ease reverse;}
.timing27.alternate {animation: move2 4s 5 ease alternate;}
.timing28.alternate-reverse {animation: move2 4s 5 ease alternate-reverse;}

πŸ“– animation-fill-mode

timing26
timing27
timing28
timing29
πŸ’‘ CSS μ½”λ“œ 보기
.timing26.show {animation: move3 3s 1 ease; animation-fill-mode: none;}
.timing27.show {animation: move3 3s 1 ease; animation-fill-mode: forwards;}
.timing28.show {animation: move3 3s 1 ease; animation-fill-mode: backwards;}
.timing29.show {animation: move3 3s 1 ease; animation-fill-mode: both;}
@keyframes move3 {
0% {left: 0%;}
100% {left: calc(100% - 120px);}
}

πŸ“– animation-play-state

timing31
πŸ’‘ CSS μ½”λ“œ 보기
.timing30.running {animation: move2 4s 100 ease; animation-play-state: running;}
.timing30.paused {animation: move2 4s 100 ease; animation-play-state: paused;}
}

πŸ“– Animatine.css

timing31
timing32
timing33
timing34
timing35
timing36
timing37
πŸ’‘ CSS μ½”λ“œ 보기
.timing30.running {animation: move2 4s 100 ease; animation-play-state: running;}
.timing30.paused {animation: move2 4s 100 ease; animation-play-state: paused;}
}

λ§›λ‚˜λŠ” λŒ“κΈ€ μ˜μ–‘λΆ„κ³Ό ꡬ독 μ˜μ–‘λΆ„μ„ ν™˜μ˜ν•©λ‹ˆλ‹ΉπŸŒ±

728x90

λŒ“κΈ€


Lucky Charms Rainbow
js
html
css