
Transition๊ณผ Animation์ ๊ฐ์ฅ ํฐ ์ฐจ์ด์ = keyframe ์ ๋ฌดAnimation์ Transtion์ ๊ฐ์ด timing-func์ ease๊ฐ default@keyframes sample-ani {
0% {
transform: translate(0, 0);
}
50% {
transform: translate(500px, 0);
background-color: red;
}
100% {
transform: translate(600px, 200px);
}
}
.box {
display: flex;
align-items: center;
justify-content: center;
width: 100px;
height: 100px;
border: 2px solid #000;
background-color: #fff000;
animation: sample-ani 2s ease infinite;
}


animation-direction : alternate, reverse
alternate-reverse๋ ๊ฐ๋ฅ! reverse๋ ์ํ๋ก alternate
animation: sample-ani 3s ease infinite alternate;
๊ธฐ๋ณธ๊ฐ์ none
forwards = ์ ๋๋ฉ์ด์
์ข
๋ฃ ์ง์ 100%์ ๋๊ธฐ
๊ธฐ๋ณธ๊ฐ์ running
์ ๋๋ฉ์ด์
paused or not
.box:hover {
animation-play-state: paused;
}

w - 5100px, h : 150px.spaceship {
width: 150px;
height: 150px;
background: url('../images/sprite_spaceship.png') no-repeat 0 0 / auto 150px;
/* 5100px 300px */
/* ์ง๊ธ์ ๊ฒฝ์ฐ, cover ๊ฐ๋ฅ */
animation: spaceship-ani s infinite steps(17) reverse;
}
background-size๋ /๋ก ๊ตฌ๋ถํด์ฃผ๋ฉด ๋๋ค =>
background: url('image.png') no-repeat 0 0 / auto 150px; }
์ด๋ฏธ์ง ์๋์ผ๋ก ๋น์จ ๋ง์ถฐ์ฃผ๊ธฐ (๋๋๊ธฐ ์ฌ์ด๊ฑฐ ํ๋๋ง 2๋ก ๋๋๊ณ => auto )
auto 150px
@keyframes spaceship-ani {
to { /* from ~ to, 0% ~ 100%*/
background-position: -2550px 0;
}
}
-2550px 0 ์ธ ์ด์ = left ๋ฐฉํฅ์ผ๋ก ํ๋ฌ๊ฐ๋ฏ์ด ์ด๋ 5100px์ด ์๋ ์ด์ = bg-size๋ฅผ ์ฒ์์ auto 150px๋ก ๋ฐ๋ต ๋น์จ๋ก ์ค์ ํ๊ธฐ ๋๋ฌธ gif๋ ์ํ ์ฑ๋(Alpha Channel), ์ฆ ํฌ๋ช
๋๊ฐ ์ ์ฉ์ด ์๋๋ค๋ ์น๋ช
์ ๋จ์ ์ด ์์
๋ํธ ์ฐ์ด์ ํํํ ํฝ์ ์ํธ๊ฐ ์๋ ์ด์, ์ด๋ฏธ์ง ๊ฐ์ฅ์๋ฆฌ๊ฐ ๊นจ์ง ๊ฒ์ฒ๋ผ ๋ณด์ (์ํฐ ์จ๋ฆฌ์ด์ฑ โ)
cf. ๋ฐ๋ฉด, png๋ ์ํ์ฑ๋์ด ์ ์ฉ๋๋ ์ด๋ฏธ์ง (apng๋ ์์ง๋ง ์ง์ ์ํ๋ ๋ธ๋ผ์ฐ์ ๋ง์)
์ํ ์ฑ๋(Alpha Channel)= ์ํ์ฑ๋(Alpha Channel)์ RGB์ฑ๋์ ์ ์ฅ๋๋ RGB๊ฐ ์ด์ธ์ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ ์ ์๋ ์ฑ๋
์ํฐ ์จ๋ฆฌ์ด์ฑ(Anti-Aliasing)= ๋์ ํด์๋์ ์ ํธ๋ฅผ ๋ฎ์ ํด์๋์์ ๋ํ๋ผ ๋ ์๊ธฐ๋ ๊ณ๋จ ํ์(๊นจ์ง ํจํด)์ ์ต์ํํ๋ ๋ฐฉ๋ฒ (์ถ์ฒ : ์ํค๋ฐฑ๊ณผ)