π
relative = νλ¦λλ‘ // μμμ : κ°μμμΉ
absolute = νλ¦λ¬΄μ // μμμ : λΆλͺ¨μμμμΉ λΆλͺ¨μμμ€μ relativeκ° μμΌλ©΄ κ·Έκ² μμμ ! relative μμΌλ©΄ bodyκ° μμμ !
fixed = νλ¦λ¬΄μ, μ€ν¬λ‘€ λ΄λ €λ κ³ μ μμΉ // μμμ : λΆλͺ¨μμ μκ΄μμ΄ κ·Έλ₯ μ 체νμ΄μ§ κΈ°μ€
linear : μΌμ ν μλ
ease : λΉ¨λΌμ§λ€κ° λλ €μ§
ease-in : λ리λ€κ° λΉ¨λΌμ§
ease-out : λΉ¨λΌμ§λ€κ° μ μ λλ €μ§
ease-in-out : λ리λ€κ° μ μ λΉ¨λΌμ§λ€κ° λ€μ λλ €μ§
cubic-bezier(1,0,.89,1.2) : λΉ λ₯΄κΈ°λ₯Ό λ΄κ° μ§μ ν μ μλ€!
ex) transition: all 1s linear 1s;
=> λͺ¨λ μμ±μ 1μ΄λμ μΌμ νμλλ‘ μ»€μμ¬λ €λκ³ 1μ΄ νμ
<style>
.box {
width: 100px;
height: 100px;
background-color: red;
margin: 10px;
transition: background-color 2s cubic-bezier(1,0,.9,.76) 1s; /*νμ€λ‘ νλ²μ μ μ©*/
}
/* λ§μ°μ€λ₯Ό μ¬λ¦¬λ©΄ -> κ°μμ νμ */
.box:hover {
background-color: blueviolet;
}
</style>
<body>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</body>
=> π»
=> λ§μ°μ€ μ¬λ €λμΌλ©΄ transition: background-color 2s cubic-bezier(1,0,.9,.76) 1s;
μ΄κ±°λλ‘ λ°°κ²½μμμ΄ 2μ΄λμ 1μ΄νμ 보λΌμμΌλ‘ λ°λλ€!
<style>
/* λ°λκΈ° μ */
.box {
width: 200px;
height: 200px;
border: 2px solid blue;
background-image: url(../../day01/images/imgtest3.jpg);
background-size: 200px 200px;
transition: all 1s linear 0.5s;
}
/* λ§μ°μ€ μ¬λ¦¬κ³ λ ν */
.box:hover {
width: 600px;
height: 600px;
border: 2px solid red;
background-image: url(../../day01/images/imgtest3.jpg);
background-size: 200px 200px;
}
</style>
<body>
<div class="box"></div>
</body>
=> π»
=> λ§μ°μ€ μ¬λ¦¬λ©΄
=> transition: all 1s linear 0.5s; λͺ¨λ μμ±μ΄ λ§μ°μ€μ¬λ¦¬λ©΄ 0.5μ΄ μλ€κ° 1μ΄λμ μΌμ νμλλ‘ λμ!
none : μμμ μ©X λλλ©΄ μλλλ‘
forwards : μμμ μ©X λλλ©΄ λ§μ§λ§ μ€νμΌλ‘ μ μ©
backwards : μμμ μ©O λλλ©΄ μλλλ‘
both : μμμ μ©O λλλ©΄ λ§μ§λ§ μ€νμΌλ‘ μ μ© @
normal : 0% -> 100% (λ
Έλ μ£Όν© λΉ¨κ°)
reverse : 100% -> 0% (λΉ¨κ° μ£Όν© λ
Έλ)
alternate : 0% -> 100% -> 0% -> 100% (normal->reverse) (μλ€κ°λ€)
alternate-reverse : 100% -> 0% -> 100% -> 0% (reverse->normal) (κ±°κΎΈλ‘ μλ€κ°λ€)
@keyframes boxAni {
0% {
background-color: red;
margin-left: 0px;
}
25% {
background-color: red;
margin-left: 0px;
}
50% {
background-color: red;
margin-left: 0px;
}
}
2. μ€ν νκ³ μΆμ λ°μ€ν΄λμ€μ animation-name: boxAni; λ£μ΄μ£Όκ³ animation-duration λ±λ±λ± μμ± μ μ΄μ£Όλ©΄ λλ€!
.box {
animation-name: boxAni;
animation-duration: 2s;
animation-delay:1s
animation-fill-mode: both;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: paused(μ μ§) , running(μ€ν) => 컀μμ¬λ €λ¨μλ μ€νλκ³ μ»€μμ¬λ €λ¨μλ μ μ§λκ² νλ κ±° νκ³ μΆμλ!!
}
=> x,y μ’νλ§νΌ μ΄λ
=> κ°λ‘,μΈλ‘ 2λ°°
=> xμΆ yμΆ κΈ°μ€ κΈ°μΈμ΄κΈ°
=> 90λ λλ €λΌ
x = left center right
y = top center bottom
transform:scale(2,2) rotate(45deg);
transition : λ€λ₯Έ μμ±λ€μ λ³ν, μΌμ μκ°λμ μμ°μ€λ½κ² // μ΄λ²€νΈ(λ§μ°μ€μ€λ²)
animation : μ¬λ¬λ¨κ³λ‘ λλ μ, μμ§μ // λͺνλ°λ³΅, 무μ ν λ°λ³΅
transform : ν¬κΈ°,νμ ,μ΄λ
transition => λ§μ°μ€μ€λ²μΌλ λ€μ μλλλ‘ λμμ€λν¨κ³ΌOOOO
animation => λ§μ°μ€μ€λ²μΌλ λ€μ μλλλ‘ λμμ€λν¨κ³ΌXXXX
transition + transform
animation + transform