summaryrefslogtreecommitdiffstats
path: root/devtools/client/animationinspector/test/doc_negative_animation.html
blob: ea412025b3ae088e9b3a415942c855f9e3c17316 (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
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <style>
  html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
  }

  div {
    position: absolute;
    top: 0;
    left: -500px;
    height: 20px;
    width: 500px;
    color: red;
    background: linear-gradient(to left, currentColor, currentColor 2px, transparent);
  }

  .zero {
    color: blue;
    top: 20px;
  }

  .positive {
    color: green;
    top: 40px;
  }

  .negative.move { animation: 5s -1s move linear forwards; }
  .zero.move { animation: 5s 0s move linear forwards; }
  .positive.move { animation: 5s 1s move linear forwards; }

  @keyframes move {
    to {
      transform: translateX(500px);
    }
  }
  </style>
</head>
<body>
  <div class="negative"></div>
  <div class="zero"></div>
  <div class="positive"></div>
  <script>
    "use strict";

    var negative = document.querySelector(".negative");
    var zero = document.querySelector(".zero");
    var positive = document.querySelector(".positive");

    // The non-delayed animation starts now.
    zero.classList.add("move");
    // The negative-delayed animation starts in 1 second.
    setTimeout(function () {
      negative.classList.add("move");
    }, 1000);
    // The positive-delayed animation starts in 200 ms.
    setTimeout(function () {
      positive.classList.add("move");
    }, 200);
  </script>
</body>
</html>