CSS transformπ μμμ νμ , ν¬κΈ°, κΈ°μΈκΈ°, μμΉ( μ΄λ ν¨κ³Ό ) λ±μ λ³ννμ¬ λ€μν μκ°μ ν¨κ³Ό ꡬν
.class {
transform: rotate(30deg);
transform: scale(1.2);
transform: skew(20deg, 25deg); /* xμΆ, yμΆ */
transform: translate(10px, 20px); /* xμΆ, yμΆ */
}
rotate()deg, turnscale()skew()deg, radtranslate()px, em, %, in, β¦translate/scale vs position/width/heighttranslate / scaleposition / width / heightCSS transitionπ CSS μμ±μ΄ λ³κ²½λ λ μ μ©λλ μ λλ©μ΄μ
μ€νμΌ λ³κ²½μ΄ μκ²Όμ λ, μ λλ©μ΄μ μ²λΌ λ³νμ΄ λ§€λλ½κ² μ΄λ£¨μ΄μ§κ² νλ€.
.class {
transition: property duration timing-function delay;
/* example
transition: border 0.2s linear 1s,
background-color: 0.2s ease-in;
*/
}
transitiontransition-propertytransition-durationtransition-timing-functionease: 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 ~ tofrom: μμ νλ μ μμ± κ° μ§μ to: λ νλ μ μμ± κ° μ§μ Animation μ¬μ©νκΈ°.class {
animation-name: duration timing-function delay iteration-count direction fill-mode play-state;
}
Animation Propertiesanimationanimation-name@keyframeμΌλ‘ μ μλ ) μ΄λ¦animation-durationanimation-timing-functiontransition κ³Ό λμΌanimation-delayanimation-iteration-countinfinite: 무ν λ°λ³΅animation-directionnormal: from β toalternate: from β to β fromreverse: to β fromalternate-reverse: to β from β toanimation-fill-modenone: defaultforwards: μ λλ©μ΄μ
ν λ§μ§λ§ μ€νμΌ μ μ§backwards: μ λλ©μ΄μ
μ 첫λ²μ§Έ μ€νμΌ μ μ§both: forwards + backwardsanimation-play-state: μ¬μ / μΌμ μ μ§ μ¬λΆtransition vs animationtransitionanimation@keyframesλ₯Ό μ¬μ©νμ¬ μ€κ° λ¨κ³ ꡬν κ°λ₯( % μ¬μ© )transition λ³΄λ€ λ³΅μ‘ν μ λλ©μ΄μ
ꡬν κ°λ₯