summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/animations/animation-direction-normal.html
blob: e86dc0cb584ab8fd264073c976eec504a59921f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Test of -webkit-animation-direction</title>
  <style type="text/css" media="screen">
    body {
      margin: 0;
    }

    #box {
      position: absolute;
      left: 0px;
      top: 100px;
      height: 100px;
      width: 100px;
      background-color: red;
      margin: 0;
      -webkit-animation-duration: 2s;
      -webkit-animation-direction: normal;
      -webkit-animation-iteration-count: 2;
      -webkit-animation-timing-function: linear;
      -webkit-animation-name: move1;
    }
    #safezone {
      position: absolute;
      top: 100px;
      height: 100px;
      width: 130px;
      left: 30px;
      background-color: green;
    }
    @-webkit-keyframes move1 {
      from { transform: translateX(0px); }
      to   { transform: translateX(200px); }
    }
  </style>
  <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" charset="utf-8">
    const expectedValues = [
      // [time, element-id, property, expected-value, tolerance]
      [0.5, "box", "webkitTransform", [1,0,0,1, 50,0], 20],
      [1.0, "box", "webkitTransform", [1,0,0,1,100,0], 20],
      [2.5, "box", "webkitTransform", [1,0,0,1, 50,0], 20],
    ];

    function pauseAnimation()
    {
        document.getElementById("box").style.webkitAnimationPlayState = "paused";
    }

    function setTimers()
    {
        setTimeout(pauseAnimation, 2500);
    }

    runAnimationTest(expectedValues, setTimers, null, true, true);

  </script>
</head>
<body>
<!-- This tests the operation of -webkit-animation-direction. After 1 second the red boxes should be hidden by the green boxes. You should see no red boxes. -->
<div id="box"></div>
<div id="safezone"></div>
<div id="result"></div>
</div>
</body>
</html>