4 <title>Test animation direction reverse with fill modes</title>
12 -webkit-animation-delay: 0.1s;
13 -webkit-animation-duration: 2s;
14 -webkit-animation-timing-function: linear;
15 -webkit-animation-name: anim;
16 -webkit-animation-direction: reverse;
18 @-webkit-keyframes anim {
23 background-color: blue;
24 -webkit-animation-fill-mode: none;
27 background-color: red;
28 -webkit-animation-fill-mode: backwards;
31 background-color: green;
32 -webkit-animation-fill-mode: forwards;
35 background-color: yellow;
36 -webkit-animation-fill-mode: both;
39 background-color: #999;
40 -webkit-animation-fill-mode: both;
41 -webkit-animation-iteration-count: 2;
42 -webkit-animation-direction: alternate-reverse;
45 <script src="resources/animation-test-helpers.js"></script>
46 <script type="text/javascript" charset="utf-8">
48 var animsFinished = 0;
50 const expectedValues = [
51 {id: "a", start: 100, end: 100},
52 {id: "b", start: 300, end: 100},
53 {id: "c", start: 100, end: 300},
54 {id: "d", start: 300, end: 300},
55 {id: "e", start: 300, end: 300}
59 if (window.layoutTestController) {
60 layoutTestController.dumpAsText();
61 layoutTestController.waitUntilDone();
64 function animationEnded(event) {
65 if (++animsFinished == numAnims) {
66 setTimeout(endTest, 0); // This call to setTimeout should be ok in the test environment
67 // since we're just giving style a chance to resolve.
73 for (var i = 0; i < expectedValues.length; i++) {
74 var realValue = getPropertyValue("left", expectedValues[i].id);
75 var expectedValue = expectedValues[i].end;
76 if (comparePropertyValue("left", realValue, expectedValue, allowance))
80 result += " - end of animation - id: " + expectedValues[i].id + " expected: " + expectedValue + " actual: " + realValue + "<br>";
82 document.getElementById('result').innerHTML = result;
84 if (window.layoutTestController)
85 layoutTestController.notifyDone();
88 window.onload = function () {
89 for (var i = 0; i < expectedValues.length; i++) {
90 var realValue = getPropertyValue("left", expectedValues[i].id);
91 var expectedValue = expectedValues[i].start;
92 if (comparePropertyValue("left", realValue, expectedValue, allowance))
96 result += " - start of animation - id: " + expectedValues[i].id + " expected: " + expectedValue + " actual: " + realValue + "<br>";
98 document.addEventListener("webkitAnimationEnd", animationEnded, false);
104 This test performs an animation of the left property with four different
105 fill modes. It animates over 0.1 second with a 0.1 second delay.
106 It takes snapshots at document load and the end of the animation.
107 <div id="a" class="box">
110 <div id="b" class="box">
113 <div id="c" class="box">
116 <div id="d" class="box">
119 <div id="e" class="box">