tizen beta release
[framework/web/webkit-efl.git] / LayoutTests / animations / play-state.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html lang="en">
3 <head>
4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5   <title>Test of -webkit-animation-play-state</title>
6   <style type="text/css" media="screen">
7     #box1 {
8       height: 100px;
9       width: 100px;
10       background-color: blue;
11       margin: 0;
12       -webkit-animation-duration: 2s;
13       -webkit-animation-timing-function: linear;
14       -webkit-animation-name: "move1";
15       -webkit-animation-play-state: running;
16     }
17     @-webkit-keyframes "move1" {
18         from { -webkit-transform: translateX(0); }
19         to   { -webkit-transform: translateX(100px); }
20     }
21     #box2 {
22       position:absolute;
23       top: 260px;
24       height: 100px;
25       width: 100px;
26       background-color: red;
27       -webkit-animation-duration: 2s;
28       -webkit-animation-timing-function: linear;
29       -webkit-animation-name: "move2";
30     }
31     @-webkit-keyframes "move2" {
32         from { left: 0; }
33         to   { left: 100px; }
34     }
35   </style>
36   <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
37   <script type="text/javascript" charset="utf-8">
38     
39     const expectedValues = [
40       // [animation-name, time, element-id, property, expected-value, tolerance]
41       ["move1", 0.5, "box1", "webkitTransform", [1,0,0,1,25,0], 15],
42       ["move1", 1.5, "box1", "webkitTransform", [1,0,0,1,50,0], 15],
43       ["move1", 2.5, "box1", "webkitTransform", [1,0,0,1,75,0], 15],
44       ["move2", 0.5, "box2", "left", 25, 15],
45       ["move3", 1.5, "box2", "left", 50, 15],
46       ["move4", 2.5, "box2", "left", 75, 15],
47     ];
48     
49     function stop()
50     {
51         document.getElementById("box1").style.webkitAnimationPlayState = "paused";
52         document.getElementById("box2").style.webkitAnimationPlayState = "paused";
53     }
54
55     function start()
56     {
57         document.getElementById("box1").style.webkitAnimationPlayState = "running";
58         document.getElementById("box2").style.webkitAnimationPlayState = "running";
59     }
60
61     function setTimers()
62     {
63         setTimeout(stop, 1000);
64         setTimeout(start, 2000);
65     }
66     
67     runAnimationTest(expectedValues, setTimers, null, true);
68     
69   </script>
70 </head>
71 <body>
72 <p>
73 This tests the operation of -webkit-animation-play-state. After 2 second the box should stop and after one
74 more second it should start again. We test it both while in motion and when stopped.
75 <div id="box1">
76 </div>
77 <div id="box2">
78 </div>
79 <div id="result">
80 </div>
81 </body>
82 </html>