-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path关键帧动画.html
59 lines (56 loc) · 1.37 KB
/
关键帧动画.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
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>关键帧动画</title>
<style type="text/css">
body{
background: black;
}
div{
width: 200px;
height: 200px;
border: 1px solid white;
position: relative;
}
div > p{
color: white;
text-align: center;
}
.keyframe{
/*-webkit-animation:myFirst 2s ease-in 1;*/
/*-o-animation:myFirst 2s ease-in 1;*/
animation:myFirst 1s ease-in 1 ;
/*-webkit-animation-fill-mode: forwards;*/
/*-moz-animation-fill-mode: forwards;*/
/*-o-animation-fill-mode: forwards;*/
animation-fill-mode: forwards;
left: 0;
top:0;
}
@keyframes myFirst {
from{
}
to{
left: 400px;
top: 300px;
width: 500px;
height: 100px;
background: red;
}
}
</style>
<script>
var div = null;
document.onclick = function () {
div || ( div = document.getElementById('demo') );
div.classList.add('keyframe');
}
</script>
</head>
<body>
<div id="demo">
<p>变形记</p>
</div>
</body>
</html>