-
Notifications
You must be signed in to change notification settings - Fork 0
/
perspective-example.html
87 lines (77 loc) · 2.14 KB
/
perspective-example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!doctype html>
<html lang="en">
<head>
<style>
.container {
width: 200px;
height: 200px;
position: relative;
margin: 0 auto 40px;
border: 1px solid #CCC;
perspective: 1000px;
}
#cube {
width: 100%;
height: 100%;
position: absolute;
transform-style: preserve-3d;
transform: translateZ( -100px );
}
#cube.spinning {
-webkit-animation: spinCubeWebkit 8s infinite ease-in-out;
}
@-webkit-keyframes spinCubeWebkit {
0% { -webkit-transform: translateZ( -100px ) rotateX( 0deg ) rotateY( 0deg ); }
100% { -webkit-transform: translateZ( -100px ) rotateX( 360deg ) rotateY( 360deg ); }
}
#cube figure {
display: block;
position: absolute;
width: 196px;
height: 196px;
border: 2px solid black;
line-height: 196px;
font-size: 120px;
font-weight: bold;
color: white;
text-align: center;
}
#cube .front { background: hsla( 0, 100%, 50%, 0.7 ); }
#cube .back { background: hsla( 60, 100%, 50%, 0.7 ); }
#cube .right { background: hsla( 120, 100%, 50%, 0.7 ); }
#cube .left { background: hsla( 180, 100%, 50%, 0.7 ); }
#cube .top { background: hsla( 240, 100%, 50%, 0.7 ); }
#cube .bottom { background: hsla( 300, 100%, 50%, 0.7 ); }
#cube .front {
transform: translateZ( 100px );
}
#cube .back {
transform: rotateX( -180deg ) translateZ( 100px );
}
#cube .right {
transform: rotateY( 90deg ) translateZ( 100px );
}
#cube .left {
transform: rotateY( -90deg ) translateZ( 100px );
}
#cube .top {
transform: rotateX( 90deg ) translateZ( 100px );
}
#cube .bottom {
transform: rotateX( -90deg ) translateZ( 100px );
}
</style>
</head>
<body>
<section class="container">
<div id="cube" class="spinning">
<figure class="front">1</figure>
<figure class="back">2</figure>
<figure class="right">3</figure>
<figure class="left">4</figure>
<figure class="top">5</figure>
<figure class="bottom">6</figure>
</div>
</section>
</body>
</html>