-
Notifications
You must be signed in to change notification settings - Fork 358
/
Copy pathAnimation.html
57 lines (52 loc) · 1.14 KB
/
Animation.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Animation</title>
<style type="text/css">
body {
margin: 50px;
text-align: center;
position: relative;
margin: ;
100px 0;
}
.row {
position: relative;
margin: 10px;
height: 155px;
background: rgba(39, 139, 210, .1);
border: 3px dashed rgba(39, 139, 210, 1);
}
.ball {
width: 150px;
height:150px;
border: 3px solid black;
background: rgba(139, 158, 67, 1);
border-radius: 50%;
}
</style>
</head>
<body>
<h1>动画 animation</h1>
<div class="row">
<div class="ball" id="ball1"></div>
</div>
<style type="text/css">
#ball1 {
animation: change-color 5s infinite;
animation-name: change-color, change-position;
position: relative;
animation-direction: alternate;
}
@keyframes change-color {
0% {background: red;}
100% {background: yellow;}
}
@keyframes change-position {
0% {left: 0;}
100% {left: calc(100% - 150px);}
}
</style>
</body>
</html>