-
Notifications
You must be signed in to change notification settings - Fork 14
/
sprite.html
executable file
·43 lines (40 loc) · 1.14 KB
/
sprite.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
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="utf-8"/>
<title>Animating with step() timing function</title>
<link href="../styles/style-edit.css" rel="stylesheet">
<style>/* bottom example uses a regular image and left property */
div {
margin-left: 45%;
margin-bottom: 1em;
}
.strip {border: 1px solid; width: 56px; height: 100px;}
.strip:hover {overflow: hidden;}
.strip img {
animation: filmstrip 4s steps(22,end) infinite;
position: relative;}
@keyframes filmstrip {
from {left: 0;}
to {left: -1232px;}
}
</style>
</head>
<body>
<style contenteditable id="editme">.dancer { width: 56px; height: 100px;
background-image: url(c/dancer.png);
animation-name: dance_in_place;
animation-duration: 4s;
animation-timing-function: steps(22, end);
animation-iteration-count: infinite;
}
@keyframes dance_in_place {
from {background-position: 0 0;}
to {background-position: -1232px 0;}
}
</style>
<div class="dancer"></div>
<div class="strip"><img src="c/dancer.png" alt="Sprite with 22 similar images with small variations"></div>
<p>Hover over the box to suppress the image outside the box</p>
</body>
</html>