1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
6 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8">
7 <title>Test simple animation with fill modes
</title>
8 <style type=
"text/css" media=
"screen">
15 -webkit-animation-delay:
0.1s;
16 -webkit-animation-duration:
0.1s;
17 -webkit-animation-timing-function: linear;
18 -webkit-animation-name: anim;
20 @-webkit-keyframes anim {
25 background-color: blue;
26 -webkit-animation-fill-mode: none;
29 background-color: red;
30 -webkit-animation-fill-mode: backwards;
33 background-color: green;
34 -webkit-animation-fill-mode: forwards;
37 background-color: yellow;
38 -webkit-animation-fill-mode: both;
41 background-color: #
999;
42 -webkit-animation-fill-mode: both;
43 -webkit-animation-iteration-count:
2;
44 -webkit-animation-direction: alternate;
47 <script type=
"text/javascript" charset=
"utf-8">
49 var animsFinished =
0;
51 const expectedValues = [
52 {id:
"a", start:
100, end:
100},
53 {id:
"b", start:
200, end:
100},
54 {id:
"c", start:
100, end:
300},
55 {id:
"d", start:
200, end:
300},
56 {id:
"e", start:
200, end:
200}
60 if (window.testRunner) {
61 testRunner.dumpAsText();
62 testRunner.waitUntilDone();
65 function animationEnded(event) {
66 if (++animsFinished == numAnims) {
67 setTimeout(endTest,
0); // this set timeout should be ok in the test environment
68 // since we're just giving style a chance to resolve
74 for (var i=
0; i < expectedValues.length; i++) {
75 var el = document.getElementById(expectedValues[i].id);
76 var expectedValue = expectedValues[i].end;
77 var realValue = parseFloat(window.getComputedStyle(el).left);
78 if (Math.abs(expectedValue - realValue) < allowance) {
83 result +=
" - end of animation - id: " + expectedValues[i].id +
" expected: " + expectedValue +
" actual: " + realValue +
"<br>";
85 document.getElementById('result').innerHTML = result;
87 if (window.testRunner)
88 testRunner.notifyDone();
91 window.onload = function () {
92 for (var i=
0; i < expectedValues.length; i++) {
93 var el = document.getElementById(expectedValues[i].id);
94 var expectedValue = expectedValues[i].start;
95 var realValue = parseFloat(window.getComputedStyle(el).left);
96 if (Math.abs(expectedValue - realValue) < allowance) {
101 result +=
" - start of animation - id: " + expectedValues[i].id +
" expected: " + expectedValue +
" actual: " + realValue +
"<br>";
103 document.addEventListener(
"webkitAnimationEnd", animationEnded, false);
109 This test performs an animation of the left property with four different
110 fill modes. It animates over
0.1 second with a
0.1 second delay.
111 It takes snapshots at document load and the end of the animation.
112 <div id=
"a" class=
"box">
115 <div id=
"b" class=
"box">
118 <div id=
"c" class=
"box">
121 <div id=
"d" class=
"box">
124 <div id=
"e" class=
"box">