-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss_3_animation.html
234 lines (185 loc) · 9.87 KB
/
css_3_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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<!doctype html>
<html >
<head>
<title>CSS3: animazioni</title>
<link rel="stylesheet" type="text/css" href="iw_examples.css"/>
<meta charset="utf-8"/>
<style type="text/css">
@keyframes animation1-frames {
from {background: red; left: 10px; top: 15px; }
to {background: yellow; left: 150px; top: 50px; }
}
@-moz-keyframes animation1-frames {
from {background: red; left: 10px; top: 15px; }
to {background: yellow; left: 150px; top: 50px; }
}
@-webkit-keyframes animation1-frames {
from {background: red; left: 10px; top: 15px; }
to {background: yellow; left: 150px; top: 50px; }
}
@-o-keyframes animation1-frames {
from {background: red; left: 10px; top: 15px; }
to {background: yellow; left: 150px; top: 50px; }
}
.animation1-holder, .animation2-holder {
position: relative;
width: 300px;
height: 200px;
border: 1px solid black;
}
.animation1 {
position: absolute;
width: 30px;
height: 30px;
animation: animation1-frames 2s linear 1s infinite alternate;
-moz-animation: animation1-frames 2s linear 1s infinite alternate;
-webkit-animation: animation1-frames 2s linear 1s infinite alternate;
-o-animation: animation1-frames 2s linear 1s infinite alternate;
}
@keyframes animation2-frames {
0% {background: red; left: 10px; top: 15px; }
30% {background: blue; left: 50px; top: 150px; }
60% {background: magenta; left: 70px; top: 100px; width: 50px; }
100% {background: yellow; left: 150px; top: 50px; height: 50px; }
}
@-moz-keyframes animation2-frames {
0% {background: red; left: 10px; top: 15px; }
30% {background: blue; left: 50px; top: 150px; }
60% {background: magenta; left: 70px; top: 100px; width: 50px; }
100% {background: yellow; left: 150px; top: 50px; height: 50px; }
}
@-webkit-keyframes animation2-frames {
0% {background: red; left: 10px; top: 15px; }
30% {background: blue; left: 50px; top: 150px; }
60% {background: magenta; left: 70px; top: 100px; width: 50px; }
100% {background: yellow; left: 150px; top: 50px; height: 50px; }
}
@-o-keyframes animation2-frames {
0% {background: red; left: 10px; top: 15px; }
30% {background: blue; left: 50px; top: 150px; }
60% {background: magenta; left: 70px; top: 100px; width: 50px; }
100% {background: yellow; left: 150px; top: 50px; height: 50px; }
}
.animation2 {
position: absolute;
width: 30px;
height: 30px;
animation: animation2-frames 5s linear 2s 1 normal forwards;
-moz-animation: animation2-frames 5s linear 2s 1 normal forwards;
-webkit-animation: animation2-frames 5s linear 2s 1 normal forwards;
-o-animation: animation2-frames 55s linear 2s 1 normal forwards;
}
</style>
</head>
<body>
<h1 class="sezione">CSS3: animazioni</h1>
<p>Le animazioni CSS permettono di definire dei percorsi di animazione per elementi della
pagina HTML. Ciascun percorso è costituito da due o più <i>frames</i>, in ciascuno dei
quali lo stile dell'elemento può essere modificato.</p>
<p>Le animazioni CSS non sono ancora supportate da tutti i browser allo stesso modo.
Per Opera, Safari, Firefox e Chrome sono disponibili estenzioni specifiche con la stessa sintassi, mentre
internet explorer non ha alcun supporto.</p>
<div class="esempi">
<div class="esempio"><div class="rendering">
<div class="animation1-holder">
<p>bla, bla, bla, bla, bla, bla, bla</p>
<div class="animation1"> </div>
<p>bla, bla, bla, bla, bla, bla, bla</p>
</div>
</div><div class="sorgente">
<h3>CSS</h3>
<p> @keyframes animation1-frames {
from {background: red; left: 10px; top: 15px; }
to {background: yellow; left: 150px; top: 50px; }
} </p>
<p> @-moz-keyframes animation1-frames {
from {background: red; left: 10px; top: 15px; }
to {background: yellow; left: 150px; top: 50px; }
}</p>
<p> @-webkit-keyframes animation1-frames {
from {background: red; left: 10px; top: 15px; }
to {background: yellow; left: 150px; top: 50px; }
} </p>
<p> @-o-keyframes animation1-frames {
from {background: red; left: 10px; top: 15px; }
to {background: yellow; left: 150px; top: 50px; }
} </p>
<p> .animation1-holder {
position: relative;
width: 300px;
height: 200px;
border: 1px solid black;
}</p>
<p> .animation1 {
position: absolute;
width: 30px;
height: 30px;
animation: animation1-frames 2s linear 1s infinite alternate;
-moz-animation: animation1-frames 2s linear 1s infinite alternate;
-webkit-animation: animation1-frames 2s linear 1s infinite alternate;
-o-animation: animation1-frames 2s linear 1s infinite alternate;
} </p>
<h3>HTML</h3>
<p> <div class="animation1-holder">
<p>bla, bla, bla, bla, bla, bla, bla</p>
<div class="animation1">&nbsp;</div>
<p>bla, bla, bla, bla, bla, bla, bla</p>
</div></p>
</div></div>
<div class="esempio"><div class="rendering">
<div class="animation2-holder">
<p>bla, bla, bla, bla, bla, bla, bla</p>
<div class="animation2"> </div>
<p>bla, bla, bla, bla, bla, bla, bla</p>
</div>
</div><div class="sorgente">
<h3>CSS</h3>
<p> @keyframes animation2-frames {
0% {background: red; left: 10px; top: 15px; }
30% {background: blue; left: 50px; top: 150px; }
60% {background: magenta; left: 70px; top: 100px; width: 50px; }
100% {background: yellow; left: 150px; top: 50px; height: 50px; }
}</p>
<p> @-moz-keyframes animation2-frames {
0% {background: red; left: 10px; top: 15px; }
30% {background: blue; left: 50px; top: 150px; }
60% {background: magenta; left: 70px; top: 100px; width: 50px; }
100% {background: yellow; left: 150px; top: 50px; height: 50px; }
}</p>
<p> @-webkit-keyframes animation2-frames {
0% {background: red; left: 10px; top: 15px; }
30% {background: blue; left: 50px; top: 150px; }
60% {background: magenta; left: 70px; top: 100px; width: 50px; }
100% {background: yellow; left: 150px; top: 50px; height: 50px; }
}</p>
<p> @-o-keyframes animation2-frames {
0% {background: red; left: 10px; top: 15px; }
30% {background: blue; left: 50px; top: 150px; }
60% {background: magenta; left: 70px; top: 100px; width: 50px; }
100% {background: yellow; left: 150px; top: 50px; height: 50px; }
} </p>
<p> .animation2-holder {
position: relative;
width: 300px;
height: 200px;
border: 1px solid black;
} </p>
<p> .animation2 {
position: absolute;
width: 30px;
height: 30px;
animation: animation2-frames 5s linear 2s 1 normal forwards;
-moz-animation: animation2-frames 5s linear 2s 1 normal forwards;
-webkit-animation: animation2-frames 5s linear 2s 1 normal forwards;
-o-animation: animation2-frames 55s linear 2s 1 normal forwards;
} </p>
<h3>HTML</h3>
<p> <div class="animation2-holder">
<p>bla, bla, bla, bla, bla, bla, bla</p>
<div class="animation2">&nbsp;</div>
<p>bla, bla, bla, bla, bla, bla, bla</p>
</div></p>
</div></div>
</div>
</body>
</html>