-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimacao.html
161 lines (135 loc) · 3.8 KB
/
animacao.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="Wesley Victor Pereira Silva" />
<meta name="description"
content="Exemplo de uso de animações CSS, incluindo keyframes, animações em elementos e timing functions." />
<meta name="keywords" content="animações CSS, keyframes, timing functions, desenvolvimento web" />
<title>Animação</title>
<style>
@keyframes anda {
from {
transform: translateX(0);
background-color: yellow;
}
50% {
background-color: green;
}
to {
transform: translateX(300px);
background-color: blue;
}
}
@keyframes altura {
0%,
100% {
height: 80px;
}
20%,
80% {
height: 120px;
}
/* 80% {
height: 120px;
} */
/* 100% {
height: 80px;
} */
}
@keyframes largura {
0% {
width: 100px;
}
100% {
width: 400px;
}
}
#anima {
outline: 3px solid red;
width: 400px;
}
#anima div {
width: 100px;
height: 50px;
background-color: #ccc;
margin-bottom: 10px;
}
#anima div:nth-child(1) {
animation-name: anda;
animation-duration: 2s;
animation-iteration-count: infinite;
animation-timing-function: linear;
animation-direction: alternate;
}
#anima div:nth-child(2) {
animation: anda 2s linear 2s 3 alternate both running;
/* animation-fill-mode: both;
animation-play-state: running; */
}
#anima div:nth-child(2):hover {
animation-play-state: paused;
}
#anima div:nth-child(3) {
/* animation: anda 2s cubic-bezier(0.39, -0.44, 0.73, 1.44) 0ms infinite alternate,
altura 2s linear 1 normal forwards; */
will-change: height;
}
#anima div:nth-child(4) {
animation: largura 5s;
animation-timing-function: steps(5, jump-end);
}
#anima div:nth-child(5) {
animation: largura 5s;
animation-timing-function: steps(5, jump-start);
}
#anima div:nth-child(6) {
animation: largura 5s;
animation-timing-function: steps(5, jump-none);
}
#anima div:nth-child(7) {
animation: largura 5s;
animation-timing-function: steps(5, jump-both);
}
ul {
list-style-type: none;
padding: 0;
display: flex;
gap: 20px;
}
li {
margin-bottom: 10px;
background-color: #f7f7f7;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
width: 7%;
}
li a {
display: block;
text-decoration: none;
color: #333;
font-weight: bold;
padding: 10px;
}
li a:hover {
color: #007bff;
}
</style>
</head>
<body>
<ul>
<li><a href="index.html">Index</a></li>
<li><a href="animacao.html">Animação</a></li>
</ul>
<div id="anima">
<div>1</div>
<div>2</div>
<div>3</div>
<div>Jump-End</div>
<div>Jump-Start</div>
<div>Jump-None</div>
<div>Jump-Both</div>
</div>
</body>
</html>