πβ λ³νμ΄λ?
- νλ¬κ·ΈμΈμ λμ μμ΄ μΉ λΈλΌμ°μ μ 3μ°¨μ 곡κ°μ ꡬνν μ μκ² λμμ
- HTML5μμ 3μ°¨μμ ꡬννλ λ°©λ²μ ν¬κ² 2κ°μ§
- μλ°μ€ν¬λ¦½νΈλ₯Ό μ¬μ©ν webGL
- CSS3λ₯Ό μ¬μ©ν 3μ°¨μ λ°°μ΄
πβ 2μ°¨μ λ°°μ΄
- λλΆλΆμ μ»΄ν¨ν° νλ‘κ·Έλ¨μ νλ©΄ μ’νλ₯Ό μ΄μ©
- XμΆκ³Ό YμΆμ΄ μλ νλ©΄ μ’νλ₯Ό 2μ°¨μ νλ©΄ μ’νλΌκ³ λΆλ¦
- ZμΆμ μΆκ°νλ©΄ 3μ°¨μ νλ©΄ μ’νλ‘ νμ₯
- 3μ°¨μ νλ©΄ μ’νμμ ZμΆμ μΉ λΈλΌμ°μ λ₯Ό 보λ μ¬μ©μμκ² κ°κΉμΈμλ‘ ν° κ°μ
πβ transform μμ±
- CSS3λΆν°λ transform μμ±μ μ¬μ©ν΄ κ°μ²΄λ₯Ό λ³νν μ μμ
- λ³νμ΄ κ°λ₯ν μ΄μΌκΈ°λ HTML νμ΄μ§ μ€μ€λ‘ μ λλ©μ΄μ
κ°μ νλμ μ½ν
μΈ λ₯Ό λ§λ€ μ μμ
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<style>
section {
width: 100px; height: 100px;
border: 5px solid black;
}
div{
width: 100px; height: 100px;
background-color: red;
transform: rotate(60deg);
}
</style>
</head>
<body>
<section>
<div></div>
</section>
</body>
</html>
- μ½λλ₯Ό μ€ννλ©΄ μ¬κ°νμ΄ 60λ νμ
πβ 2μ°¨μ λ³ν ν¨μ
- νλ‘κ·Έλλ° μΈμ΄μμλ μλ³μ λ€μ κ΄νΈκ° μμ κ²½μ° ν΄λΉ μλ³μλ₯Ό ν¨μλΌκ³ λΆλ¦
- transform μμ± μμ ν¨μ μ¬μ©
translate(transiateX, translateY |
νΉμ ν¬κΈ°λ§νΌ μ΄λ |
translateX(translateX) |
xμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ μ΄λ |
translateY(translateY) |
yμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ μ΄λ |
scale(scaleX, scaleY) |
νΉμ ν¬κΈ°λ§νΌ νλ λ° μΆμ |
scaleX(scaleX) |
xμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ νλ λ° μΆμ |
scaleY(scaleY) |
yμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ νλ λ° μΆμ |
skew(angleX, angleY) |
νΉμ κ°λλ§νΌ κΈ°μΈμ |
skewX(angleX) |
xμΆμΌλ‘ νΉμ κ°λλ§νΌ κΈ°μΈμ |
skewY(angleY) |
yμΆμΌλ‘ νΉμ κ°λλ§νΌ κΈ°μΈμ |
rotate(angleZ) |
νΉμ κ°λλ§νΌ νμ |
- transform μμ±μ κ°κ°μ ν¨μλ₯Ό 곡백μΌλ‘ ꡬλΆν΄ μ
λ ₯νλ©΄λ¨
πβ transform-origin μμ±
- λ³ν μ€μ¬μ μ€μ νλ μ€νμΌ μμ±
- νκ·Έ μμμ μ€μ¬μ λ³ν μ€μ¬μΌλ‘ μ‘μ
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<style>
section {
width: 100px;
height: 100px;
border: 5px solid black;
}
div{
width: 100px; height: 100px;
background-color: red;
transform: rotate(60deg);
}
</style>
</head>
<body>
<section>
<div></div>
</section>
</body>
</html>
- rotate() λ³ν ν¨μλ₯Ό μ¬μ©νμμΌλ―λ‘ μ¬κ°νμ΄ 60λ νμ
- μ¬κ°νμ μ€μ¬μ κΈ°μ€μΌλ‘ νμ
- λ³ν μ€μ¬μ λ³κ²½ν λ transform-origin μμ± μ¬μ©
- 2κ°μ ν¬κΈ° λ¨μ μ μ© κ°λ₯
- κ°κ° λ³ν μ€μ¬μ Xμ’νμ Yμ’ν μλ―Έ
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<style>
section {
width: 100px;
height: 100px;
border: 5px solid black;
}
div{
width: 100px; height: 100px;
background-color: red;
transform: rotate(60deg);
transform-origin: 100% 100%;
}
</style>
</head>
<body>
<section>
<div></div>
</section>
</body>
</html>
πβ 3μ°¨μ λ³ν ν¨μ
translate(translateX, translateY, translateZ) |
νΉμ ν¬κΈ°λ§νΌ μ΄λ |
rotateY(angleY) |
yμΆμΌλ‘ νΉμ κ°λλ§νΌ νμ |
translateX(translateX) |
xμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ μ΄λ |
rotateZ(angleZ) |
zμΆμΌλ‘ νΉμ κ°λλ§νΌ νμ |
translateY(translateY) |
yμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ μ΄λ |
|
|
translateZ(translateZ) |
zμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ μ΄λ |
|
|
scale3d(scaleX, scaleY, scaleZ) |
νΉμ ν¬κΈ°λ§νΌ νλ λ° μΆμ |
|
|
scaleX(scaleX) |
xμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ νλ λ° μΆμ |
|
|
scaleY(scaleY) |
yμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ νλ λ° μΆμ |
|
|
scaleZ(scaleZ) |
zμΆμΌλ‘ νΉμ ν¬κΈ°λ§νΌ νλ λ° μΆμ |
|
|
rotate3d(angleX, angleY, angleZ) |
νΉμ κ°λλ§νΌ νμ |
|
|
rotateX(angleX) |
xμΆμΌλ‘ νΉμ κ°λλ§νΌ νμ |
|
|
- section νκ·Έλ‘ κ°μΈ νλμ κ°μ²΄μ²λΌ λ§λ¬
- div νκ·Έμ position μμ±μ absolute ν€μλλ₯Ό μ μ©νκ³ left μμ±κ³Ό top μμ±μ μ¬μ©ν΄ νλλ‘ λμΉ¨
- κ°κ°μ νκ·Έλ₯Ό μ λΉν κ°λλ‘ νμ μν€κ³ μΈκ³½μΌλ‘ λ°μ΄λ²λ¦Ό
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<style>
body {
width: 200px;
margin: 200px auto;
}
section {
width: 200px; height: 200px;
position: relative;
}
div {
width: 200px; height: 200px;
position: absolute; left: 0; top: 0;
opacity: 0.3;
}
/* μλ©΄ */
div:nth-child(1) {transform: rotate(0deg) translate3d(0px, 0px, 100px);}
div:nth-child(2) {transform: rotate(90deg) translate3d(0px, 0px, 100px);}
div:nth-child(3) {transform: rotate(180deg) translate3d(0px, 0px, 100px);}
div:nth-child(4) {transform: rotate(270deg) translate3d(0px, 0px, 100px);}
/* μλ©΄κ³Ό μλ«λ©΄ */
div:nth-child(5) {transform: rotate(90deg) translate3d(0px, 0px, 100px);}
div:nth-child(6) {transform: rotate(270deg) translate3d(0px, 0px, 100px);}
</style>
</head>
<body>
<section>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</section>
</body>
</html>
- κ°κ°μ div νκ·Έμ μμ μ
λ ₯
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<style>
body {
width: 200px;
margin: 200px auto;
}
section {
width: 200px; height: 200px;
position: relative;
}
div {
width: 200px; height: 200px;
position: absolute; left: 0; top: 0;
opacity: 0.3;
}
/* μλ©΄ */
div:nth-child(1) {
transform: rotateY(0deg) translate3d(0px, 0px, 100px);
background: red;
}
div:nth-child(2) {
transform: rotateY(90deg) translate3d(0px, 0px, 100px);
background: green;
}
div:nth-child(3) {
transform: rotateY(180deg) translate3d(0px, 0px, 100px);
background: blue;
}
div:nth-child(4) {
transform: rotateY(270deg) translate3d(0px, 0px, 100px);
background: yellow;
}
/* μλ©΄κ³Ό μλ«λ©΄ */
div:nth-child(5) {
transform: rotateX(90deg) translate3d(0px, 0px, 100px);
background: brown;
}
div:nth-child(6) {
transform: rotateX(270deg) translate3d(0px, 0px, 100px);
background: pink;
}
</style>
</head>
<body>
<section>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</section>
</body>
</html>
πβ transform-style μμ±
- λ³νμ μ μ©ν λ κ·Έ μν₯λ ₯μ΄ μμ μκ²λ§ μ μ©λ μ§ μμμκ²λ μ μ©λ μ§ μ νλ μμ±
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<style>
body {
width: 200px;
margin: 200px auto;
}
section {
width: 200px; height: 200px;
position: relative;
animation: rint 3s linear 0s infinite;
}
@keyframes rint{
from{
transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}
to{
transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
}
}
div {
width: 200px; height: 200px;
position: absolute; left: 0; top: 0;
opacity: 0.3;
}
/* μλ©΄ */
div:nth-child(1) {
transform: rotateY(0deg) translate3d(0px, 0px, 100px);
background: red;
}
div:nth-child(2) {
transform: rotateY(90deg) translate3d(0px, 0px, 100px);
background: green;
}
div:nth-child(3) {
transform: rotateY(180deg) translate3d(0px, 0px, 100px);
background: blue;
}
div:nth-child(4) {
transform: rotateY(270deg) translate3d(0px, 0px, 100px);
background: yellow;
}
/* μλ©΄κ³Ό μλ«λ©΄ */
div:nth-child(5) {
transform: rotateX(90deg) translate3d(0px, 0px, 100px);
background: brown;
}
div:nth-child(6) {
transform: rotateX(270deg) translate3d(0px, 0px, 100px);
background: pink;
}
</style>
</head>
<body>
<section>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</section>
</body>
</html>
- μ μ‘면체λ₯Ό λ΄κ³ μλ νμ΄ μμ§μ΄λ―λ‘ μ μ‘λ©΄μ²΄κ° μμ§μΌ κ²μ΄λΌκ³ κΈ°λν μ μμ§λ§ νλ©΄μ΄ νμ
- μμμ 3μ°¨μ μμ±μ μ μ§ν μ±λ‘ λΆλͺ¨λ₯Ό νμ μν€κ³ μΆμ λλ λΆλͺ¨μ transform-style μμ±μ preserve-3d ν€μλ μ μ©
- section νκ·Έμ trandform-style μμ±μ preserve-3d ν€μλλ₯Ό μ μ©
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<style>
body {
width: 200px;
margin: 200px auto;
}
section {
width: 200px; height: 200px;
position: relative;
animation: rint 3s linear 0s infinite;
transform-style: preserve-3d;
}
@keyframes rint{
from{
transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}
to{
transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
}
}
div {
width: 200px; height: 200px;
position: absolute; left: 0; top: 0;
opacity: 0.3;
}
/* μλ©΄ */
div:nth-child(1) {
transform: rotateY(0deg) translate3d(0px, 0px, 100px);
background: red;
}
div:nth-child(2) {
transform: rotateY(90deg) translate3d(0px, 0px, 100px);
background: green;
}
div:nth-child(3) {
transform: rotateY(180deg) translate3d(0px, 0px, 100px);
background: blue;
}
div:nth-child(4) {
transform: rotateY(270deg) translate3d(0px, 0px, 100px);
background: yellow;
}
/* μλ©΄κ³Ό μλ«λ©΄ */
div:nth-child(5) {
transform: rotateX(90deg) translate3d(0px, 0px, 100px);
background: brown;
}
div:nth-child(6) {
transform: rotateX(270deg) translate3d(0px, 0px, 100px);
background: pink;
}
</style>
</head>
<body>
<section>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</section>
</body>
</html>
- μ μ‘λ©΄μ²΄κ° νμ
- transform-style μμ±μλ μ΄μ κ°μ ν€μλ μ¬μ©
flat |
νμμ 3μ°¨μ μμ± λ¬΄μ |
preserve-3d |
νμμ 3μ°¨μ μμ± μ μ§ |
πβ backface-visibility μμ±
- 3μ°¨μ 곡κ°μμ νλ©΄μ νλ©΄μ 보μ΄κ±°λ 보μ΄μ§ μκ² λ§λλ μ€νμΌ μμ±
- div νκ·Έμ backface-visibility μμ±μ hidden ν€μλ μ μ©
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<style>
body {
width: 200px;
margin: 200px auto;
}
section {
width: 200px; height: 200px;
position: relative;
animation: rint 3s linear 0s infinite;
transform-style: preserve-3d;
}
@keyframes rint{
from{
transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}
to{
transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
}
}
div {
width: 200px; height: 200px;
position: absolute; left: 0; top: 0;
backface-visibility: hidden;
opacity: 0.3;
}
/* μλ©΄ */
div:nth-child(1) {
transform: rotateY(0deg) translate3d(0px, 0px, 100px);
background: red;
}
div:nth-child(2) {
transform: rotateY(90deg) translate3d(0px, 0px, 100px);
background: green;
}
div:nth-child(3) {
transform: rotateY(180deg) translate3d(0px, 0px, 100px);
background: blue;
}
div:nth-child(4) {
transform: rotateY(270deg) translate3d(0px, 0px, 100px);
background: yellow;
}
/* μλ©΄κ³Ό μλ«λ©΄ */
div:nth-child(5) {
transform: rotateX(90deg) translate3d(0px, 0px, 100px);
background: brown;
}
div:nth-child(6) {
transform: rotateX(270deg) translate3d(0px, 0px, 100px);
background: pink;
}
</style>
</head>
<body>
<section>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</section>
</body>
</html>
- νλ©΄μ νλ©΄μ΄ μ¬λΌμ§ κ²μ νμΈν μ μμ
- μ΄μ κ°μ ν€μλ μ¬μ©
visible |
νλ©΄μ 보μ΄κ² λ§λ¬ |
hidden |
νλ©΄μ 보μ΄μ§ μκ² λ§λ¬ |
πβ μκ·Όλ²
- perspective μμ±μ μκ·Όλ²μ μ§μ νλ μμ±
- perspective μμ±μ νλ©΄μ μΌλ§λ λ§μ 3μ°¨μ ν½μ
μ λμ κ²μΈμ§ μ μνλ μμ±
- perspective μμ±μλ 400ν½μ
μμ 2000ν½μ
μ¬μ΄μ μ«μ μ
λ ₯
- body νκ·Έμ perspective μμ±κ° 400 μ μ©
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
<style>
body {
width: 200px;
margin: 200px auto;
-webkit-perspective: 400;
}
section {
width: 200px; height: 200px;
position: relative;
animation: rint 3s linear 0s infinite;
transform-style: preserve-3d;
}
@keyframes rint{
from{
transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}
to{
transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg);
}
}
div {
width: 200px; height: 200px;
position: absolute; left: 0; top: 0;
backface-visibility: hidden;
opacity: 0.3;
}
/* μλ©΄ */
div:nth-child(1) {
transform: rotateY(0deg) translate3d(0px, 0px, 100px);
background: red;
}
div:nth-child(2) {
transform: rotateY(90deg) translate3d(0px, 0px, 100px);
background: green;
}
div:nth-child(3) {
transform: rotateY(180deg) translate3d(0px, 0px, 100px);
background: blue;
}
div:nth-child(4) {
transform: rotateY(270deg) translate3d(0px, 0px, 100px);
background: yellow;
}
/* μλ©΄κ³Ό μλ«λ©΄ */
div:nth-child(5) {
transform: rotateX(90deg) translate3d(0px, 0px, 100px);
background: brown;
}
div:nth-child(6) {
transform: rotateX(270deg) translate3d(0px, 0px, 100px);
background: pink;
}
</style>
</head>
<body>
<section>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</section>
</body>
</html>
- μ μ‘λ©΄μ²΄κ° νμ
- μ
체κ°μ΄ λκ»΄μ§λ μ μ‘λ©΄μ²΄κ° λ¨
πβ νμ λͺ©λ§ - body νκ·Έ ꡬμ±
- κ°λ¨ν μκ° νμ΄μ§μ νμ λͺ©λ§λ₯Ό μ¬λ €λ div νκ·Έλ₯Ό λ§λ€κ³ id μμ±κ°μΌλ‘ canvasμ μ
λ ₯
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
</style>
</head>
<body>
<h1>HTML5 + CSS3 for Modern Web</h1>
<h2>CSS transform</h2>
<p>3D Merry Go Round Gallery</p>
<hr/>
<div id="canvas">
</div>
</body>
</html>
- νμ λͺ©λ§ μ΄ μμ±
- νμ λͺ©λ§μ μλ 10κ°
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
</style>
</head>
<body>
<h1>HTML5 + CSS3 for Modern Web</h1>
<h2>CSS transform</h2>
<p>3D Merry Go Round Gallery</p>
<hr/>
<div id="canvas">
<div id="merry">
<div class="face"></div>
<div class="face"></div>
<div class="face"></div>
<div class="face"></div>
<div class="face"></div>
<div class="face"></div>
<div class="face"></div>
<div class="face"></div>
<div class="face"></div>
<div class="face"></div>
</div>
</div>
</body>
</html>
- #canvas νκ·Έλ λ¨μ§ νμ λͺ©λ§ κ°μ²΄λ₯Ό μ λΉν μμΉμ λκΈ° μν΄ λ§λ νκ·Έ
- #merry νκ·Έλ νμ λͺ©λ§ κ°μ²΄ μλ―Έ
- λ΄λΆμ μ΄μ κ°κ°μ μ
μ μ
λ ₯
- class μμ±κ°μΌλ‘ faceλ₯Ό λΆμ¬ν div νκ·Έμ div νκ·Έλ₯Ό 4κ°μ© λκ³ class μμ±κ°μΌλ‘ cell μ
λ ₯
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
</style>
</head>
<body>
<h1>HTML5 + CSS3 for Modern Web</h1>
<h2>CSS transform</h2>
<p>3D Merry Go Round Gallery</p>
<hr/>
<div id="canvas">
<div id="merry">
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
</div>
</div>
</body>
</html>
πβ νμ λͺ©λ§ - μ€νμΌ μ¬μ©
- λͺ¨λ μ€νμΌ μ¬μ©μ μμμ μ΄κΈ°ν
- λͺ¨λ νκ·Έμ margin μμ±κ³Ό padding μμ±μ μ΄κΈ°ννκ³ html νκ·Έμ body νκ·Έμ height μμ±λ μ΄κΈ°ν
- νμ λͺ©λ§ λ΄λΆμ μ΄κ³Ό μ
μ μμΉλ₯Ό μ‘μλ΄
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
* {margin: 0; padding: 0;}
html, body {height: 100%;}
body {
width: 600px;
margin: 0 auto;
}
#canvas {
position: absolute;
width: 100px; height: 200px;
-webkit-perspective: 1500;
}
#merry {
position: absolute;
left: 50%; top: 50%;
transform-style: preserve-3d;
}
.face {
position: absolute;
left: 0; top: 0;
margin-left: -115px;
backface-visibility: hidden;
transform-style: preserve-3d;
}
.cell {
width: 230px; height: 150px;
margin-bottom: 5px;
background: url('http://placehold.it/260x200');
background-size: 100% 100%;
transition-duration: 0.5s;
}
.face:nth-child(1) {transform: rotate(0deg) translateZ(-370px);}
.face:nth-child(2) {transform: rotate(36deg) translateZ(-370px);}
.face:nth-child(3) {transform: rotate(72deg) translateZ(-370px);}
.face:nth-child(4) {transform: rotate(108deg) translateZ(-370px);}
.face:nth-child(5) {transform: rotate(144deg) translateZ(-370px);}
.face:nth-child(6) {transform: rotate(180deg) translateZ(-370px);}
.face:nth-child(7) {transform: rotate(216deg) translateZ(-370px);}
.face:nth-child(8) {transform: rotate(252deg) translateZ(-370px);}
.face:nth-child(9) {transform: rotate(288deg) translateZ(-370px);}
.face:nth-child(10) {transform: rotate(324deg) translateZ(-370px);}
.cell:hover{
transform: scale(1.2) translateZ(50px);
}
</style>
</head>
<body>
<h1>HTML5 + CSS3 for Modern Web</h1>
<h2>CSS transform</h2>
<p>3D Merry Go Round Gallery</p>
<hr/>
<div id="canvas">
<div id="merry">
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
</div>
</div>
</body>
</html>
πβ νμ λͺ©λ§ - μ λλ©μ΄μ
μ μ©
- νμ λͺ©λ§κ° νμ μ΄ κ°λ₯νλλ‘ μ λλ©μ΄μ
μ μ©
- #merry μ νμμ animation μμ± μ¬μ©
- μ λλ©μ΄μ
μ΄λ¦μ rintμ΄κ³ 15μ΄ λμ 무ν λ°λ³΅
- μ λλ©μ΄μ
μ΄λ¦μ rintλ₯Ό μ
λ ₯νμΌλ―λ‘ rint ν€ νλ μ μμ±
- ν€ νλ μμ μμ±νμ¬ 15μ΄ λμ ν λ°ν΄λ₯Ό λκ² λ§λ¬
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
* {margin: 0; padding: 0;}
html, body {height: 100%;}
body {
width: 600px;
margin: 0 auto;
}
#canvas {
position: relative;
width: 100px; height: 200px;
-webkit-perspective: 1500px;
}
#merry {
position: absolute;
left: 50%; top: 30%;
transform-style: preserve-3d;
animation: rint 15s infinite linear;
}
@keyframes rint{
from {transform: rotate(0deg)}
to{transform: rotate(360deg);}
}
.face {
position: absolute;
left: 0; top: 0;
margin-left: -115px;
backface-visibility: hidden;
transform-style: preserve-3d;
}
.cell {
width: 230px; height: 150px;
margin-bottom: 5px;
background: url('http://placehold.it/260x200');
background-size: 100% 100%;
transition-duration: 0.5s;
}
.face:nth-child(1) {transform: rotate(0deg) translateZ(-370px);}
.face:nth-child(2) {transform: rotate(36deg) translateZ(-370px);}
.face:nth-child(3) {transform: rotate(72deg) translateZ(-370px);}
.face:nth-child(4) {transform: rotate(108deg) translateZ(-370px);}
.face:nth-child(5) {transform: rotate(144deg) translateZ(-370px);}
.face:nth-child(6) {transform: rotate(180deg) translateZ(-370px);}
.face:nth-child(7) {transform: rotate(216deg) translateZ(-370px);}
.face:nth-child(8) {transform: rotate(252deg) translateZ(-370px);}
.face:nth-child(9) {transform: rotate(288deg) translateZ(-370px);}
.face:nth-child(10) {transform: rotate(324deg) translateZ(-370px);}
.cell:hover{
transform: scale(1.2) translateZ(50px);
}
</style>
</head>
<body>
<h1>HTML5 + CSS3 for Modern Web</h1>
<h2>CSS transform</h2>
<p>3D Merry Go Round Gallery</p>
<hr/>
<div id="canvas">
<div id="merry">
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
<div class="face">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
</div>
</div>
</body>
</html>