Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
            
- /css/css-view-transitions/scoped/crashtests/mask-image.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<html class="test-wait">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Scoped VT with mask-image</title>
</head>
<style>
  .block {
    background-color: red;
    contain: strict;
    position: relative;
    z-index: 0;
    width: 150px;
    height: 100px;
    border: 5px solid black;
  }
  .scope1 {
    view-transition-name: scope1;
  }
  .scope2 {
    view-transition-name:  scope2;
  }
  .mask {
    mask-image: linear-gradient(rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
  }
</style>
<body>
  <div id="target1" class="block scope1 mask"></div>
  <div id="target2" class="block scope2"></div>
</body>
<script>
  async function runTest() {
    const vt1 = target1.startViewTransition(() => {
      target1.classList.remove('mask');
    });
    const vt2 = target2.startViewTransition(() => {
      target2.classList.add('mask');
    });
    await Promise.all([vt1.finished, vt2.finished]);
    document.documentElement.classList.remove('test-wait');
  }
  window.onload = runTest();
</script>
</html>