tor-browser

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

animateMotion-from-to-rotate-auto.html (1226B)


      1 <!doctype html>
      2 <title>&lt;animateMotion> from/to animation with rotate=auto</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/SVGAnimationTestCase-testharness.js"></script>
      6 <svg>
      7  <rect x="-200" width="200" height="100" fill="blue">
      8    <animateMotion id="anim" from="0,400" to="0,-100" rotate="auto"
      9                   fill="freeze" dur="4s"/>
     10  </rect>
     11 </svg>
     12 <script>
     13 const rootSVGElement = document.querySelector('svg');
     14 
     15 function assert_bbox_position(element, x, y) {
     16  const bbox = element.getBBox();
     17  const epsilon = 0.5;
     18  assert_approx_equals(bbox.x, x, epsilon, 'bbox x');
     19  assert_approx_equals(bbox.y, y, epsilon, 'bbox y');
     20 }
     21 
     22 function sample1() {
     23  assert_bbox_position(rootSVGElement, 0, 600);
     24 }
     25 
     26 function sample2() {
     27  assert_bbox_position(rootSVGElement, 0, 150);
     28 }
     29 
     30 function sample3() {
     31  assert_bbox_position(rootSVGElement, 0, -100);
     32 }
     33 
     34 smil_async_test(t => {
     35  const expectedValues = [
     36    // [animationId, time, sampleCallback]
     37    ['anim', 0.0, sample1],
     38    ['anim', 2.0, sample2],
     39    ['anim', 4.0, sample3],
     40  ];
     41  runAnimationTest(t, expectedValues);
     42 });
     43 
     44 window.animationStartsImmediately = true;
     45 </script>