μ¬νκΉμ§ λ¨μν λ³νμ λν΄μλ§ μμ보μλ€λ©΄
μ΄λ²μλ μμ ν λ€λ₯Έ μ€νμΌλ‘ λ°κΏ μ μλ
νΈλμ§μ μ λν΄μ μμ보μ.
νΈλμ§μ (transition)
μκ°μ λ°λΌμ μΉ μμμ μ€νμΌ μμ±μ΄ μ‘°κΈμ© λ°λλ κ²μ΄λ€.
transition-property μμ± : νΈλμ§μ μ μ©ν μμ± μ§μ
νΈλμ§μ μ μ΄λ μμ±μ μ μ©ν κ²μΈμ§ μ ννλ κ²μΌλ‘
ν΄λΉ μμ±μ μ¬μ©νμ§ μμ κ²½μ°,
λͺ¨λ μμ±μ΄ νΈλμ§μ λμμ΄ λκ³
νΉμ μμ± μ΄λ¦μ μ λ ₯νλ©΄ κ·Έ μμ±μ νΈλμ§μ μ΄ μ μ©λλ€.
transition-duration μμ± : νΈλμ§μ μ§νμκ° μ§μ
ν΄λΉ μμ±μ μ¬μ©ν΄ μ ν΄λμ μκ° λμ μμ±μ΄ μμ°μ€λ½κ² λ°λλ μ λλ©μ΄μ ν¨κ³Όλ‘
μ΄(seconds) λλ λ°λ¦¬μ΄(milliseconds)λ‘ λνλΈλ€.
μ΄λ, νΈλμ§μ
λμμ΄ λλ μμ±μ΄ μ¬λ¬ κ°λΌλ©΄
μΌνλ‘ κ΅¬λΆν΄ μ¬λ¬ κ°λ₯Ό μ§μ ν μ μλ€.
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>transition-duration</title>
<style>
.trduration {
width: 100px;
height: 100px;
background-color: blue;
border: 2px black solid;
-webkit-transition-property: width, height;
-moz-transition-property: width, height;
-o-transition-property: width, height;
transition-property: width, height; /* νΈλμ§μ
μ μ©λμ : λλΉμ λμ΄ */
-webkit-transition-duration: 2s, 1s;
-moz-transition-duration: 2s, 1s;
-o-transition-duration: 2s, 1s;
transition-duration: 2s, 1s; /* λλΉλ 2μ΄, λμ΄λ 1μ΄λ§μ μ μ© */
}
.trduration:hover {
width: 200px;
height: 120px;
}
</style>
</head>
<body>
<h3>μ ν΄μ§ μκ° λμ λμ΄μ λλΉ λ°κΎΈκΈ°</h3>
<div class="trduration"></div>
</body>
</html>
transition-propertyμμ μ§μ ν μμ±μ κ°μμ transition-durationμμ μ§μ ν μκ°μ κ°μκ° μΌμΉν κ²½μ°
μμ± κ°μμ μ§μ ν μμλλ‘ μκ°μ μ μ©ν μ μλλ°,
λ§μ½ μμ±μ κ°μμ μκ°μ κ°μκ° μΌμΉνμ§ μμ κ²½μ°
transition-durationμ΄ transition-propertyμ κ°μμ
λ§κ² μμλλ‘ λ°λ³΅ μ μ©ν΄ μ£Όλ©΄ λλ€.
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>transition-duration</title>
<style>
.trduration2 {
width: 100px;
height: 100px;
background-color: red;
border: black 2px solid;
text-align: center;
-webkit-transition-property: background-color, transform, width, height;
-moz-transition-property: background-color, transform, width, height;
-o-transition-property: background-color, transform, width, height;
transition-property: background-color, transform, width, height;
-webkit-transition-duration: 2s, 3s;
-moz-transition-duration: 2s, 3s;
-o-transition-duration: 2s, 3s;
transition-duration: 2s 3s; /* νΈλμ§μ
μ μ©λμ λ²κ°μκ°λ©° μ μ© */
}
.trduration2:hover {
background-color: pink; /* 2μ΄ κ±Έμ³ νΈλμ§μ
*/
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-o-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg); /* 3μ΄ κ±Έμ³ νΈλμ§μ
*/
width: 200px; /* 2μ΄ κ±Έμ³ νΈλμ§μ
*/
height: 200px; /* 3μ΄ κ±Έμ³ νΈλμ§μ
*/
}
</style>
</head>
<body>
<h3>μ ν΄μ§ μκ° λμ λ°°κ²½ μκ³Ό νμ , λμ΄, λλΉ λ°κΎΈκΈ°</h3>
<div class="trduration2"><h1>λν</h1></div>
</body>
</html>
transition-timing-function μμ± : νΈλμ§μ μλ 곑μ μ§μ
μμκ³Ό μ€κ°, λμμμ μλλ₯Ό μ§μ ν΄ μλ 곑μ μ λ§λ€μ΄ μ£Όλ κ²μΌλ‘
μλ 곑μ μ 미리 μ ν΄μ§ ν€μλλ 'λ² μ§μ 곑μ 'μ μ΄μ©ν΄ νννλ€.
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>transition-timing-function</title>
<style>
#tfunction div{
float: left;
width: 100px;
height: 50px;
margin: 5px 10px;
padding: 5px;
color: white;
background-color: rgb(160, 80, 120);
border-radius: 5px;
text-align: center;
font-weight: bold;
}
#tfunction:hover div {height: 400px;}
#tfunction .linear1 {
-webkit-transition: 3s linear;
-moz-transition: 3s linear;
-o-transition: 3s linear;
transition: 3s linear;
}
#tfunction .ease1 {
-webkit-transition: 3s ease;
-moz-transition: 3s ease;
-o-transition: 3s ease;
transition: 3s ease;
}
#tfunction .ease-in1 {
-webkit-transition: 3s ease-in;
-moz-transition: 3s ease-in;
-o-transition: 3s ease-in;
transition: 3s ease-in;
}
#tfunction .ease-out1 {
-webkit-transition: 3s ease-out;
-moz-transition: 3s ease-out;
-o-transition: 3s ease-out;
transition: 3s ease-out;
}
#tfunction .ease-in-out1 {
-webkit-transition: 3s ease-in-out;
-moz-transition: 3s ease-in-out;
-o-transition: 3s ease-in-out;
transition: 3s ease-in-out;
}
</style>
</head>
<body>
<h3>νΈλμ§μ
μλ 곑μ μμ±κ°</h3>
<div id="tfunction">
<div class="linear1">linear</div>
<div class="ease1">ease</div>
<div class="ease-in1">ease-in</div>
<div class="ease-out1">ease-out</div>
<div class="ease-in-out1">ease-in-out</div>
</div>
</body>
</html>
transition-delay μμ± : μ§μ° μκ° μ€μ
νΈλμ§μ
μ΄ μΈμ λΆν° μμν κ²μΈμ§λ₯Ό μ€μ νλ κ²μΌλ‘
μ§μ ν μκ°λ§νΌ κΈ°λ€λ Έλ€κ° νΈλμ§μ
μ΄ μμλλ€.
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>transition-delay</title>
<style>
#trdelay {
position: relative;
width: 500px;
height: 150px;
margin: 0 auto;
border: 2px solid gray;
border-radius: 30px;
padding: 20px;
}
#trdelay:hover .box {
-webkit-transform: rotate(720deg);
-moz-transform: rotate(720deg);
-ms-transform: rotate(720deg);
-o-transform: rotate(720deg);
transform: rotate(720deg);
margin-left: 420px;
}
.box {
font-size: 12px;
position: relative;
width: 60px;
height: 60px;
margin-bottom: 10px;
background-color: lightgray;
}
.box p {
text-align: center;
padding-top: 4px;
}
#no-delay {
-webkit-transition-duration: 3s;
-moz-transition-duration: 3s;
-o-transition-duration: 3s;
transition-duration: 3s;
border: 2px solid rgb(255, 136, 0);
}
#delay {
-webkit-transition-duration: 3s;
-moz-transition-duration: 3s;
-o-transition-duration: 3s;
transition-duration: 3s;
-webkit-transition-delay: 1s;
-moz-transition-delay: 1s;
-o-transition-delay: 1s;
transition-delay: 1s;
border: 2px solid blue;
}
</style>
</head>
<body>
<h3>νΉμ μκ° νμ νΈλμ§μ
μ€ννκΈ°</h3>
<div id="trdelay">
<div id="no-delay" class="box"><p>no-delay</p></div>
<div id="delay" class="box"><p>delay</p></div>
</div>
</body>
</html>
transition μμ± : νΈλμ§μ μμ± νκΊΌλ²μ νκΈ°
νΈλμ§μ μ μ© λμμ΄ μ 체μ΄κ³ νΈλμ§μ μ€ν μκ°μ΄ λμλ³λ‘ λ€λ₯΄μ§ μμ κ²½μ°μ
νκΊΌλ²μ μ§μ ν΄ μ¬μ©νκΈ° νΈλ¦¬ν μμ±μΌλ‘
λμ΄ μμλ§ μ λλ‘ μ
λ ₯νλ©΄ λλ€.
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>transition</title>
<style>
.tr {
width: 200px;
height: 200px;
background-color: red;
border: 2px black solid;
-webkit-transition: 2s ease-in;
-moz-transition: 2s ease-in;
-o-transition: 2s ease-in;
transition: 2s ease-in;
/* transition-property κΈ°λ³Έκ° all
transition-duration κ° 2s
transition-timing-function κ° ease-in
transition-delay κΈ°λ³Έκ° 0*/
}
.tr:hover {
width: 100px;
height: 100px;
background-color: pink;
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
}
</style>
</head>
<body>
<h3>transition μμ± νκΊΌλ²μ νκΈ°νκΈ°</h3>
<div class="tr"></div>
</body>
</html>
νΈλμ§μ μλ μ λμ¬κ° λ€μ΄κ°λ κ²κ³Ό
νΈλμ€νΌκ³Όλ λΉμ·νλ©΄μλ κ΅μ₯ν λ€λ₯Έ λλμ΄λΌ
μ μκ³ μμ΄μΌκ² λ€.
< μ°Έκ³ >
Do it! HTML5+CSS3 μΉ νμ€μ μ μ
β» ν΄λΉ κΈμ μ΅λ λͺ©μ μΌλ‘ μμ±λ κΈμ λλ€ β»
'κ°μΈκ³΅λΆ > HTML5 + CSS3' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[HTML+CSS][λ°μν μΉ] 01 - λ°μν μΉκ³Ό λ·°ν¬νΈ(viewport)μ κ°λ (0) | 2020.08.02 |
---|---|
[HTML+CSS][CSS3μ μ λλ©μ΄μ ] 05 - μ°μ΅λ¬Έμ (0) | 2020.08.01 |
[HTML+CSS][CSS3μ μ λλ©μ΄μ ] 02 - λ³νκ³Ό κ΄λ ¨λ μμ±λ€ (0) | 2020.07.29 |
[HTML+CSS][CSS3μ μ λλ©μ΄μ ] 01 - λ³ν (0) | 2020.07.24 |
[HTML+CSS][λ€μ¬λ€λ₯ν CSS3 μ νμ] 04 - μ°μ΅λ¬Έμ (0) | 2020.07.23 |
λκΈ