Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <style>
    div {
      background-color: lime;
      height: 100px;
    }
    </style>
  </head>
  <body>
    <script>
    "use strict";
    const duration = 100000;
    function createAnimation(cls) {
      const div = document.createElement("div");
      div.classList.add(cls);
      document.body.appendChild(div);
      const animation = div.animate([{ opacity: 0 }], duration);
      animation.playbackRate = 1.5;
    }
    createAnimation("div1");
    createAnimation("div2");
    </script>
  </body>
</html>