Skip to content

Instantly share code, notes, and snippets.

View alvinwan's full-sized avatar
🦉
🧀🍰

Alvin Wan alvinwan

🦉
🧀🍰
View GitHub Profile
@alvinwan
alvinwan / cube-style-1.css
Created February 21, 2019 18:17
The noob's guide to 3D Transforms with CSS - Cube Example, Style 1
.scene {
width:10em;
height:10em;
perspective:10em;
}
@alvinwan
alvinwan / flipping-card-style-4.css
Created February 21, 2019 18:14
The noob's guide to 3D Transforms with CSS - Flipping Card Example, Style 4
.scene:hover .card {
transform: rotateY(180deg);
}
@alvinwan
alvinwan / flipping-card-style-3.css
Created February 21, 2019 18:13
The noob's guide to 3D Transforms with CSS - Flipping Card Example, Style 3
.face {
width:100%;
height:100%;
color:#FFF;
line-height:15em;
text-align:center;
position:absolute;
backface-visibility:hidden;
@alvinwan
alvinwan / flipping-card-style-2.css
Created February 21, 2019 18:13
The noob's guide to 3D Transforms with CSS - Flipping Card Example, Style 2
.card {
width:100%;
height:100%;
position:relative;
transition: transform 0.5s;
transform-style: preserve-3d;
}
@alvinwan
alvinwan / flipping-card-style-1.css
Created February 21, 2019 18:12
The noob's guide to 3D Transforms with CSS - Flipping Card Example, Style 1
.scene {
width:10em;
height:15em;
perspective: 30em;
}
@alvinwan
alvinwan / perspective-property.css
Created February 21, 2019 18:10
The noob's guide to 3D Transforms with CSS - Perspective Property
.scene.close {
perspective: 10em;
}
.scene.medium {
perspective: 20em;
}
.scene.far {
perspective: 100em;
@alvinwan
alvinwan / frame-of-reference.css
Created February 21, 2019 18:07
The noob's guide to 3D Transforms with CSS - Frame of Reference Style
.parent {
transform: translateX(20px);
}
.child {
transform: translateY(20px);
}
@alvinwan
alvinwan / noob-3d-css-translate.css
Created February 21, 2019 18:06
The noob's guide to 3D Transforms with CSS - Translations
.translated-square {
transform:
translateX(20px) /* move right */
translateY(-20px) /* move down */
translateZ(20px); /* move closer to viewer */
}
.translated-square-shorthand {
transform: translate3d(20px, -20px, 20px);
}
@alvinwan
alvinwan / noob-3d-css-scale.css
Created February 21, 2019 18:06
The noob's guide to 3D Transforms with CSS - Scaling
.scaled-square {
transform:
scaleX(20deg) /* flip "up" */
scaleY(-20deg) /* flip "right" */
scaleZ(20deg); /* rotate counter-clockwise */
}
.scaled-square-shorthand {
transform: scale3d(20deg, -20deg, 20deg);
}
@alvinwan
alvinwan / cube.html
Last active February 21, 2019 18:20
The noob's guide to 3D Transforms with CSS - Cube Example
<div class="scene">
<div class="cube">
<div class="face front">front</div>
<div class="face right">right</div>
<div class="face left">left</div>
<div class="face back">back</div>
<div class="face top">top</div>
<div class="face bottom">bottom</div>
</div>
</div>