【代码】四叶草旋转动画

前言

四叶草旋转动画

源代码

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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* {
margin: 0px;
padding: 0px;
}

#container {
position: relative;
width: 200px;
height: 200px;
margin: 100px auto;
animation: donghua 5s linear 0s infinite;
}

#container>div:nth-child(1) {
position: absolute;
width: 100px;
height: 100px;
background: green;
left: 0px;
top: 0px;
border-radius: 0px 300px 0px 300px;
}

#container>div:nth-child(2) {
position: absolute;
width: 100px;
height: 100px;
background: green;
left: 100px;
top: 0px;
border-radius: 300px 0px 300px 0px;
}

#container>div:nth-child(3) {
position: absolute;
width: 100px;
height: 100px;
background: green;
left: 0px;
top: 100px;
border-radius: 300px 0px 300px 0px;
}

#container>div:nth-child(4) {
position: absolute;
width: 100px;
height: 100px;
background: green;
left: 100px;
top: 100px;
border-radius: 0px 300px 0px 300px;
}

@-webkit-keyframes donghua {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

#container:hover {
animation-play-state: paused;
}

</style>
</head>
<body>

<div id="container">
<div></div>
<div></div>
<div></div>
<div></div>
</div>

</body>
</html>

完成

参考文献

哔哩哔哩——web前端小清风