css3-弹簧

1
2
3
4
5
6
7
8
<div class="wrap">
<div class="tan"></div>
<div class="tan"></div>
<div class="tan"></div>
<div class="tan"></div>
<div class="tan"></div>
<div class="tan"></div>
</div>
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
.wrap {
width: 400px;
height: 400px;
transform: rotateX(60deg);
position: relative;
transform-style: preserve-3d;
}

.wrap div {
position: absolute;
border: 15px solid #ccd7d9;
border-color: #ccd7d9 #d2dbde #d7e0e2 #d2dbde;
border-radius: 50%;
box-shadow: 0 1px 0 #fff, 0 10px 0 #abbdc1 inset, 0 10px 0 #abbdc1;
transform: translateZ(-50px);
}

.wrap .tan:nth-child(1) {
left: calc(400px / 2 - 340px / 2 - 15px);
top: calc(400px / 2 - 340px / 2 - 15px);
width: 340px;
height: 340px;

animation: play1 2s 2400ms ease-in-out infinite alternate;
}

.wrap .tan:nth-child(2) {
left: calc(400px / 2 - 280px / 2 - 15px);
top: calc(400px / 2 - 280px / 2 - 15px);
width: 280px;
height: 280px;
animation: play1 2s 2000ms ease-in-out infinite alternate;
}

.wrap .tan:nth-child(3) {
left: calc(400px / 2 - 220px / 2 - 15px);
top: calc(400px / 2 - 220px / 2 - 15px);
width: 220px;
height: 220px;
animation: play1 2s 1600ms ease-in-out infinite alternate;
}

.wrap .tan:nth-child(4) {
left: calc(400px / 2 - 160px / 2 - 15px);
top: calc(400px / 2 - 160px / 2 - 15px);
width: 160px;
height: 160px;
animation: play1 2s 1200ms ease-in-out infinite alternate;
}

.wrap .tan:nth-child(5) {
left: calc(400px / 2 - 100px / 2 - 15px);
top: calc(400px / 2 - 100px / 2 - 15px);
width: 100px;
height: 100px;
animation: play1 2s 800ms ease-in-out infinite alternate;
}

.wrap .tan:nth-child(6) {
left: calc(400px / 2 - 40px / 2 - 15px);
top: calc(400px / 2 - 40px / 2 - 15px);
width: 40px;
height: 40px;
animation: play1 2s 400ms ease-in-out infinite alternate;
}
@keyframes play1 {
from {
transform: translateZ(-50px);
}

to {
transform: translateZ(100px);
}
}