OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <title>Test of animation-direction</title> | |
3 <script src="../resources/testharness.js"></script> | |
4 <script src="../resources/testharnessreport.js"></script> | |
5 <style> | |
6 #target { | |
7 animation-direction: alternate-reverse; | |
8 animation-duration: 2s; | |
9 animation-iteration-count: 2; | |
10 animation-name: move; | |
11 animation-play-state: paused; | |
12 animation-timing-function: linear; | |
13 animation-fill-mode: both; | |
14 | |
15 | |
16 background-color: red; | |
17 height: 100px; | |
18 left: 500px; | |
19 position: absolute; | |
20 width: 100px; | |
21 } | |
22 @keyframes move { | |
23 from { left: 0px; } | |
24 to { left: 400px; } | |
25 } | |
26 | |
27 </style> | |
28 <div id="target"></div> | |
29 <script> | |
30 'use strict'; | |
31 test(function() { | |
32 target.style.animationDelay = '1s'; | |
33 assert_equals(getComputedStyle(target).left, '400px'); | |
34 | |
35 target.style.animationDelay = '-0.5s'; | |
36 assert_equals(getComputedStyle(target).left, '300px'); | |
37 | |
38 target.style.animationDelay = '-1s'; | |
39 assert_equals(getComputedStyle(target).left, '200px'); | |
40 | |
41 target.style.animationDelay = '-2s'; | |
42 assert_equals(getComputedStyle(target).left, '0px'); | |
43 | |
44 target.style.animationDelay = '-2.5s'; | |
45 assert_equals(getComputedStyle(target).left, '100px'); | |
46 | |
47 target.style.animationDelay = '-3s'; | |
48 assert_equals(getComputedStyle(target).left, '200px'); | |
49 | |
50 target.style.animationDelay = '-4s'; | |
51 assert_equals(getComputedStyle(target).left, '400px'); | |
52 | |
53 target.style.animationDelay = '-5s'; | |
54 assert_equals(getComputedStyle(target).left, '400px'); | |
55 }, "animation-direction alternate-reverse plays backwards, then forwards"); | |
56 </script> | |
OLD | NEW |