-
Notifications
You must be signed in to change notification settings - Fork 14
/
animation-step-direction.html
executable file
·65 lines (55 loc) · 1.62 KB
/
animation-step-direction.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Step animation direction</title>
<style type="text/css">
html {background: silver;}
body {background: white; margin: 1em; padding: 1em;}
.diagram {height: 100px; width: 1000px;
background: linear-gradient(to right,
#CCC 10%, 10%,
#BBB 20%, 20%,
#AAA 30%, 30%,
#999 40%, 40%,
#888 50%, 50%,
#777 60%, 60%,
#666 70%, 70%,
#555 80%, 80%,
#444 90%, 90%,
#333 100%
);}
.label {text-align: center; font: 2em Arvo, serif;}
code {font: 1em monospace, serif;}
section .label {background: url(i/anim-arrow.png) no-repeat 0 100% / 900px 40px;
width: 1000px; padding: 30px 0; margin: 0;}
#dg02 + .label {background-position: 100px 0;}
body:hover {background: #FFE;}
body:hover * {animation-play-state: paused;}
.stepanim {height: 100px; width: 100px;
background: green; color: white; display: flex;
justify-content: center; align-items: center; font: 2em Arvo, serif;
animation: stepcolor 7.5s steps(9,end) forwards, stepmove 7.5s steps(9,end) forwards;}
#an02 {animation-timing-function: steps(9,start), steps(9,start);}
@keyframes stepcolor {
from {background: #CCC;}
to {background: #333;}
}
@keyframes stepmove {
from {margin-left: 0;}
to {margin-left: 900px;}
}
</style>
</head>
<body>
<p class="label">Hover the mouse pointer over the <code>body</code> (the white area) to pause animations. Reload to restart them.</p>
<section>
<p class="label">end</p>
<div id="dg01" class="diagram"></div>
<div id="an01" class="stepanim">end</div>
<div id="an02" class="stepanim">start</div>
<div id="dg02" class="diagram"></div>
<p class="label">start</p>
</section>
</body>
</html>