-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3d.css
62 lines (59 loc) · 1.56 KB
/
3d.css
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
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: #000;
/* 表示离多远来看这个盒子 */
perspective: 1300px;
/* 表示从哪个角度去看 */
perspective-origin: bottom;
}
@keyframes rotate-center {
0% {
transform: rotateY(0deg);
}
100% {
transform: rotateY(360deg);
}
}
section {
position: relative;
width: 200px;
height: 300px;
cursor: pointer;
transform-style: preserve-3d;
animation: rotate-center 20s linear infinite;
&:hover {
animation-play-state: paused;
}
}
section div {
position: absolute;
left: 0;
top: -150px;
width: 100%;
height: 100%;
text-align: center;
/* 设置元素的倒影效果 below 是倒影效果在元素下方 15px 是元素和倒影的距离 后面的属性和背景渐变色是一个属性 设置了一个从下到上由背景透明色过渡到设置了不透明度的白色 */
/* -webkit-box-reflect: below 15px -webkit-linear-gradient(transparent 10%, rgba(255, 255, 255, 0.5)); */
-webkit-box-reflect: below 5px -webkit-linear-gradient(top, rgba(255, 0, 0, 0), rgba(255, 0, 0, 1));
}
section div:nth-child(1) {
transform: translateZ(350px);
}
section div:nth-child(2) {
transform: rotateY(72deg) translateZ(300px);
}
section div:nth-child(3) {
transform: rotateY(144deg) translateZ(300px);
}
section div:nth-child(4) {
transform: rotateY(216deg) translateZ(300px);
}
section div:nth-child(5) {
transform: rotateY(288deg) translateZ(300px);
}
/* section div:nth-child(6) {
transform: rotateY(300deg) translateZ(300px);
} */