-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimation.html
104 lines (90 loc) · 2.19 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Animation playground">
<title>Animation</title>
<style>
@keyframes color {
from {
background-color: red;
}
50% {
background-color: orange;
}
to {
background-color: red;
}
}
@keyframes movement {
0% {
background-color: red;
left: 0px;
top: 0px;
}
25% {
background-color: orange;
left: 100px;
top: 0px;
}
50% {
background-color: yellow;
left: 100px;
top: 200px;
}
75% {
background-color: orange;
left: 0px;
top: 200px;
}
100% {
background-color: red;
left: 0px;
top: 0px;
}
}
.color {
width: 100px;
height: 100px;
animation-name: color;
animation-duration: 4s;
animation-iteration-count: infinite;
animation-timing-function: cubic-bezier(0.23, 1, 0.320, 1);
}
.movement {
width: 100px;
height: 100px;
position: relative;
animation-name: movement;
animation-duration: 4s;
animation-iteration-count: infinite;
/*
ease - Specifies an animation with a slow start, then fast, then end slowly (this is default)
linear - Specifies an animation with the same speed from start to end
ease-in - Specifies an animation with a slow start
ease-out - Specifies an animation with a slow end
ease-in-out - Specifies an animation with a slow start and end
cubic-bezier(n,n,n,n) - Lets you define your own values in a cubic-bezier function
*/
animation-timing-function: cubic-bezier(0.77, 0, 0.175, 1)
}
.box {
width: 100px;
height: 100px;
background: red;
transition: width 500ms;
}
.box:hover {
width: 200px;
}
</style>
</head>
<body>
<h1>Animation</h1>
<div class="color"></div>
<div class="movement"></div>
<div class="box"></div>
</body>
</html>