CSS transform
π μμμ νμ , ν¬κΈ°, κΈ°μΈκΈ°, μμΉ( μ΄λ ν¨κ³Ό ) λ±μ λ³ννμ¬ λ€μν μκ°μ ν¨κ³Ό ꡬν
.class {
transform: rotate(30deg);
transform: scale(1.2);
transform: skew(20deg, 25deg); /* xμΆ, yμΆ */
transform: translate(10px, 20px); /* xμΆ, yμΆ */
}
rotate()
deg
, turn
scale()
skew()
deg
, rad
translate()
px
, em
, %
, in
, β¦translate/scale
vs
position/width/height
translate
/ scale
position
/ width
/ height
CSS transition
π CSS μμ±μ΄ λ³κ²½λ λ μ μ©λλ μ λλ©μ΄μ
μ€νμΌ λ³κ²½μ΄ μκ²Όμ λ, μ λλ©μ΄μ μ²λΌ λ³νμ΄ λ§€λλ½κ² μ΄λ£¨μ΄μ§κ² νλ€.
.class {
transition: property duration timing-function delay;
/* example
transition: border 0.2s linear 1s,
background-color: 0.2s ease-in;
*/
}
transition
transition-property
transition-duration
transition-timing-function
ease
: default, μ²μκ³Ό λμ λλ¦¬κ³ μ€κ°μ λΉ λ₯΄κ² λ³νlinear
: μμλΆν° λκΉμ§ μΌμ ν μλλ‘ λ³νease-in
: μ²μμλ λ리κ², λλ¨Έμ§λ μΌμ ν μλλ‘ λ³νease-out
: μ²μμλ μΌμ ν μλ, λλ¨Έμ§λ λλ¦¬κ² λ³νease-in-out
: μ²μκ³Ό λμ λλ¦¬κ³ μ€κ°μ λΉ λ₯΄κ² λ³νease
λ³΄λ€ λμ± κΈκ²©ν λ³νtransition-delay
,
,
λ‘ κ΅¬λΆνμ¬ μμ±Animation
π μ€νμΌμ λ³νλ₯Ό ν΅ν΄ μ λλ©μ΄μ μ νν
duaration
κ³Όdelay
μμ μμ±μ μ£Όμ !!
Animation μ μνκΈ°
@keyframes animation-name {
from {
/* μ λλ©μ΄μ
μμν λμ μν */
}
to {
/* μ λλ©μ΄μ
λμ νμ μν */
}
}
@keyframes animation-name {
0% {
}
50% {
}
100% {
}
}
%
0%
: μμ νλ μ μμ± κ° μ§μ n%
: n% μ§νλ νλ μ μμ± κ° μ§μ 100%
: λ νλ μ μμ± κ° μ§μ from
~ to
from
: μμ νλ μ μμ± κ° μ§μ to
: λ νλ μ μμ± κ° μ§μ Animation μ¬μ©νκΈ°
.class {
animation-name: duration timing-function delay iteration-count direction fill-mode play-state;
}
Animation Properties
animation
animation-name
@keyframe
μΌλ‘ μ μλ ) μ΄λ¦animation-duration
animation-timing-function
transition
κ³Ό λμΌanimation-delay
animation-iteration-count
infinite
: 무ν λ°λ³΅animation-direction
normal
: from β toalternate
: from β to β fromreverse
: to β fromalternate-reverse
: to β from β toanimation-fill-mode
none
: defaultforwards
: μ λλ©μ΄μ
ν λ§μ§λ§ μ€νμΌ μ μ§backwards
: μ λλ©μ΄μ
μ 첫λ²μ§Έ μ€νμΌ μ μ§both
: forwards
+ backwards
animation-play-state
: μ¬μ / μΌμ μ μ§ μ¬λΆtransition
vs
animation
transition
animation
@keyframes
λ₯Ό μ¬μ©νμ¬ μ€κ° λ¨κ³ ꡬν κ°λ₯( %
μ¬μ© )transition
λ³΄λ€ λ³΅μ‘ν μ λλ©μ΄μ
ꡬν κ°λ₯