tor-browser

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

web-animations-api.html (1723B)


      1 <!DOCTYPE html>
      2 <html class=reftest-wait>
      3 <title>View transitions: capture opacity elements</title>
      4 <link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
      5 <link rel="author" href="mailto:khushalsagar@chromium.org">
      6 <link rel="match" href="web-animations-api-ref.html">
      7 <meta name="fuzzy" content="maxDifference=0-2; totalPixels=0-500">
      8 
      9 <script src="/common/reftest-wait.js"></script>
     10 <style>
     11 #first {
     12  background: blue;
     13  width: 100px;
     14  height: 100px;
     15  contain:  paint;
     16 }
     17 #second {
     18  background: green;
     19  width: 100px;
     20  height: 100px;
     21  contain: paint;
     22 }
     23 
     24 /* Unset all animations since the test drives it using WA-API */
     25 html::view-transition-group(*),
     26 html::view-transition-image-pair(*),
     27 html::view-transition-new(*),
     28 html::view-transition-old(*) {
     29  animation: unset;
     30 }
     31 
     32 html::view-transition-group(root){
     33  opacity: 0;
     34 }
     35 
     36 </style>
     37 <div id=first></div>
     38 <div id=second></div>
     39 <script>
     40 failIfNot(document.startViewTransition, "Missing document.startViewTransition");
     41 
     42 function setAnimation() {
     43  document.documentElement.animate({ transform: ['translate(100px)', 'translate(100px)'] }, { duration: 10000, pseudoElement: '::view-transition-group(first)'});
     44  document.documentElement.animate({ transform: ['translate(150px)', 'translate(150px)'] }, { duration: 10000, pseudoElement: '::view-transition-group(second)'});
     45  requestAnimationFrame(takeScreenshot);
     46 }
     47 
     48 async function runTest() {
     49  first.style.viewTransitionName = "first";
     50  document.startViewTransition(() => {
     51    first.style.viewTransitionName = "";
     52    second.style.viewTransitionName = "second";
     53    requestAnimationFrame(setAnimation);
     54  });
     55 }
     56 onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
     57 </script>