-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcss3d.html
More file actions
64 lines (60 loc) · 1.67 KB
/
css3d.html
File metadata and controls
64 lines (60 loc) · 1.67 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>3D Cube</title>
<style>
body {
margin: 0;
height: 100vh;
background: #111;
display: flex;
align-items: center;
justify-content: center;
perspective: 1000px; /* adds 3D depth */
}
.scene {
width: 200px;
height: 200px;
position: relative;
transform-style: preserve-3d;
animation: rotate 10s linear infinite;
}
.face {
position: absolute;
width: 200px;
height: 200px;
background: rgba(0, 255, 0, 0.6);
border: 2px solid #0f0;
box-shadow: 0 0 20px #0f0;
display: flex;
align-items: center;
justify-content: center;
font-size: 30px;
color: black;
font-family: sans-serif;
}
.front { transform: rotateY(0deg) translateZ(100px); }
.back { transform: rotateY(180deg) translateZ(100px); }
.right { transform: rotateY(90deg) translateZ(100px); }
.left { transform: rotateY(-90deg) translateZ(100px); }
.top { transform: rotateX(90deg) translateZ(100px); }
.bottom { transform: rotateX(-90deg) translateZ(100px); }
@keyframes rotate {
from { transform: rotateX(0deg) rotateY(0deg); }
to { transform: rotateX(360deg) rotateY(360deg); }
}
</style>
</head>
<body>
<div class="scene">
<div class="face front">Front</div>
<div class="face back">Back</div>
<div class="face right">Right</div>
<div class="face left">Left</div>
<div class="face top">Top</div>
<div class="face bottom">Bottom</div>
</div>
</body>
</html>