0af7d4efb49a7114c6d48e639c3299b4af1c8a6b
[WebKit-https.git] / LayoutTests / animations / multiple-animations.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
2
3 <html lang="en">
4 <head>
5   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6   <title>Test animation with multiple concurrent animations</title>
7   <style type="text/css" media="screen">
8     #box1 {
9       position: relative;
10       left: 10px;
11       top: 10px;
12       height: 100px;
13       width: 100px;
14       background-color: blue;
15       -webkit-animation-duration: 2s;
16       -webkit-animation-timing-function: linear;
17       -webkit-animation-name: anim1;
18     }
19     @-webkit-keyframes anim1 {
20         from { left: 10px; }
21         40% { left: 30px; }
22         60% { left: 10px; }
23         to   { left: 20px; }
24     }
25     #box2 {
26       position: relative;
27       left: 10px;
28       top: 10px;
29       height: 100px;
30       width: 100px;
31       background-color: blue;
32       -webkit-animation-duration: 2s;
33       -webkit-animation-timing-function: linear;
34       -webkit-animation-name: anim2;
35     }
36     @-webkit-keyframes anim2 {
37         from { left: 10px; }
38         50% { left: 30px; }
39         to   { left: 20px; }
40     }
41   </style>
42   <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
43   <script type="text/javascript" charset="utf-8">
44
45     const expectedValues = [
46       // [animation-name, time, element-id, property, expected-value, tolerance]
47       ["anim1", 0.4, "box1", "left", 20, 2],
48       ["anim2", 0.5, "box2", "left", 20, 2],
49       ["anim2", 1.0, "box2", "left", 30, 2],
50       ["anim1", 1.2, "box1", "left", 10, 2],
51       ["anim2", 1.5, "box2", "left", 25, 2],
52       ["anim1", 1.6, "box1", "left", 15, 2],
53     ];
54
55     runAnimationTest(expectedValues);
56     
57   </script>
58 </head>
59 <body>
60 This test performs animations of the left property on two boxes over 2 seconds.
61 It takes 3 snapshots each and expects each result to be within a specified range.
62 <div id="box1">
63 </div>
64 <div id="box2">
65 </div>
66 <div id="result">
67 </div>
68 </body>
69 </html>