tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

progress-based-effect-delay.tentative.html (1714B)


      1 <html class="reftest-wait">
      2 <title>Animation effect delays should be accounted for when using a progress based timeline</title>
      3 <link rel="help" href="https://drafts.csswg.org/scroll-animations/">
      4 <meta name="assert" content="Effect delay should be accounted for by progress based animations">
      5 <link rel="match" href="progress-based-effect-delay-ref.html">
      6 
      7 <script src="/web-animations/testcommon.js"></script>
      8 <script src="/common/reftest-wait.js"></script>
      9 
     10 <style>
     11  #box {
     12    width: 100px;
     13    height: 100px;
     14    background-color: green;
     15  }
     16 
     17  #covered {
     18    width: 100px;
     19    height: 100px;
     20    background-color: red;
     21  }
     22 
     23  #scroller {
     24    overflow: auto;
     25    height: 100px;
     26    width: 100px;
     27    will-change: transform; /* force compositing */
     28  }
     29 
     30  #contents {
     31    height: 1000px;
     32    width: 100%;
     33  }
     34 </style>
     35 
     36 <div id="box"></div>
     37 <div id="covered"></div>
     38 <div id="scroller">
     39  <div id="contents"><p>Scrolling Contents</p></div>
     40 </div>
     41 <script>
     42  const box = document.getElementById('box');
     43  const effect = new KeyframeEffect(box,
     44    [
     45    { transform: 'translateY(0)', opacity: 1},
     46    { transform: 'translateY(200px)', opacity: 0}
     47    ], {
     48      delay: 1000,
     49      duration: 1000
     50    }
     51  );
     52 
     53  const scroller = document.getElementById('scroller');
     54  const timeline = new ScrollTimeline(
     55      { source: scroller, orientation: 'block' });
     56  const animation = new Animation(effect, timeline);
     57 
     58  animation.play();
     59 
     60  animation.ready.then(() => {
     61    // Move the scroller to the halfway point.
     62    const maxScroll = scroller.scrollHeight - scroller.clientHeight;
     63    scroller.scrollTop = 0.75 * maxScroll;
     64 
     65    waitForAnimationFrames(2).then(_ => {
     66        takeScreenshot();
     67    });
     68  });
     69 </script>