summaryrefslogtreecommitdiffstats
path: root/devtools/client/animationinspector/test/doc_end_delay.html
blob: 02018bc8a4a29a1267cf101689fefcc9336e2b69 (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
68
69
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <style>
  .target {
    width: 50px;
    height: 50px;
    background: blue;
  }
  </style>
</head>
<body>
  <div id="target1" class="target"></div>
  <div id="target2" class="target"></div>
  <div id="target3" class="target"></div>
  <div id="target4" class="target"></div>
  <script>
    /* globals KeyframeEffect, Animation */
    "use strict";

    let animations = [{
      id: "target1",
      frames: [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }],
      timing: {
        id: "endDelay_animation1",
        duration: 1000000,
        endDelay: 500000,
        fill: "none"
      }
    }, {
      id: "target2",
      frames: [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }],
      timing: {
        id: "endDelay_animation2",
        duration: 1000000,
        endDelay: -500000,
        fill: "none"
      }
    }, {
      id: "target3",
      frames: [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }],
      timing: {
        id: "endDelay_animation3",
        duration: 1000000,
        endDelay: -1500000,
        fill: "forwards"
      }
    }, {
      id: "target4",
      frames: [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }],
      timing: {
        id: "endDelay_animation4",
        duration: 100000,
        delay: 100000,
        endDelay: -1500000,
        fill: "forwards"
      }
    }];

    for (let {id, frames, timing} of animations) {
      let effect = new KeyframeEffect(document.getElementById(id),
                                      frames, timing);
      let animation = new Animation(effect, document.timeline);
      animation.play();
    }
  </script>
</body>
</html>