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
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<style>
.wrapper{
border: 1px solid black;
width: 300px;
height: 300px;
border-radius: 50%;
margin: 90px auto;
/* animation: ballRotate 2s linear 0s infinite; */
perspective: 3000px;
transform-style: preserve-3d;
position: relative;
transform: rotateX(-30deg) rotateZ(-30deg);
background: chocolate;
}
.wrapper::after{
content: '';
position: absolute;
width: 2px;
height: 500px;
left: 149px;
background: #a94c4c;
top: -100px;
border-radius: 5px;
}
.inner1{
width: 300px;
height: 300px;
border: 1px solid red;
border-radius: 50%;
transform: rotateY(36deg);
position: absolute;
top: 0;
left: 0;
background: antiquewhite;
}
.f1{
border: 1px solid blue;
transform: rotateY(72deg);
background: aqua;
}
.f2{
border: 1px solid green;
transform: rotateY(108deg);
background: brown;
}
.f3{
border: 1px solid #464646;
transform: rotateY(144deg);
background: blueviolet;
}
@keyframes ballRotate{
from {
transform: rotateX(-30deg) rotateZ(-30deg) rotateY(0);
}
to{
transform: rotateX(-30deg) rotateZ(-30deg) rotateY(360deg);
}
}
</style>
<body>
<div class="wrapper">
<div class="inner1"></div>
<div class="inner1 f1"></div>
<div class="inner1 f2"></div>
<div class="inner1 f3"></div>
</div>
</body>
</html>