-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path九边形.html
More file actions
94 lines (90 loc) · 2.31 KB
/
九边形.html
File metadata and controls
94 lines (90 loc) · 2.31 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.container {
width: 100%;
height: 100%;
perspective: 800px;
-webkit-perspective:800px;
transform-style: preserve-3d;
display: flex;
align-items: center;
justify-content: center;
}
.wrap {
height: 500px;
width: 500px;
display: flex;
position: relative;
justify-content: center;
align-items: center;
transform-style: preserve-3d;
transform: rotateX(-45deg);
transition: all 1s ease;
}
.item {
position: absolute;
width: 200px;
height: 200px;
background-color: #aaa;
border: 1px solid red;
}
.item:nth-child(1) {
transform: rotate3d(0,1,0,-160deg)translateZ(275px);
}
.item:nth-child(2) {
transform: rotate3d(0,1,0,-120deg) translateZ(275px);
}
.item:nth-child(3) {
transform: rotate3d(0,1,0,-80deg)translateZ(275px);
}
.item:nth-child(4) {
transform: rotate3d(0,1,0,-40deg) translateZ(275px);
}
.item:nth-child(5) {
transform: translateZ(275px);
}
.item:nth-child(6) {
transform: rotate3d(0,1,0,40deg) translateZ(275px);
}
.item:nth-child(7) {
transform: rotate3d(0,1,0,80deg) translateZ(275px) ;
}
.item:nth-child(8) {
transform: rotate3d(0,1,0,120deg)translateZ(275px) ;
}
.item:nth-child(9) {
transform: rotate3d(0,1,0,160deg)translateZ(275px);
}
</style>
</head>
<body>
<button onclick="clickMe()" style="position: absolute; top: 1000px;">旋转</button>
<div class="container">
<div class="wrap">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
</div>
</div>
</body>
<script>
let index = 1
let clickMe = () => {
let dom = document.getElementsByClassName('wrap')[0]
dom.style.transform = `rotateY(${-40 * index}deg) rotateX(-45deg)`
index ++
}
</script>
</html>