summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/motion/offset-rotate-004.html
blob: 33783d423b50585c3da0cd37f13df4763774bd38 (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
<!DOCTYPE html>
<html class="reftest-wait">
  <head>
    <title>CSS Motion Path: offset-rotate</title>
    <link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-rotate-property">
    <link rel="match" href="offset-rotate-ref.html">
    <meta name="assert" content="This tests offset-rotate auto with path()">
    <style>
      #target {
        position: absolute;
        left: 300px;
        top: 100px;
        width: 300px;
        height: 200px;
        background-color: lime;
        transform-origin: 0px 0px;
        offset-rotate: auto;
      }
    </style>
    <script>
      function test() {
        let target = document.getElementById('target');
        // Get a path which has the same direction as "ray(120deg ...)"
        let verticalMove = 100 * Math.tan(30 * Math.PI / 180);
        target.style.offsetPath = `path("m 0 0 l 100 ${verticalMove}")`;
        window.getComputedStyle(target).offsetPath;

        window.requestAnimationFrame(function() {
          document.documentElement.removeAttribute('class');
        });
      }
    </script>
  </head>
  <body onload='test()'>
    <div id="target"></div>
  </body>
</html>