tor-browser

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

animate-path-to-animation.tentative.html (1609B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>calcMode spline with 'to' animation</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/resources/SVGAnimationTestCase-testharness.js"></script>
      7 <script src="support/animated-path-helpers.js"></script>
      8 <svg></svg>
      9 <script>
     10 var rootSVGElement = document.querySelector("svg");
     11 
     12 // Setup test document
     13 var path = createSVGElement("path");
     14 path.setAttribute("id", "path");
     15 path.setAttribute("d", "M 40 40 L 60 40 L 60 60 L 40 60 Z");
     16 path.setAttribute("fill", "green");
     17 
     18 var animate = createSVGElement("animate");
     19 animate.setAttribute("id", "animation");
     20 animate.setAttribute("attributeName", "d");
     21 animate.setAttribute("to", "M 0 0 L 100 0 L 100 100 L 0 100 z");
     22 animate.setAttribute("begin", "0s");
     23 animate.setAttribute("dur", "4s");
     24 path.appendChild(animate);
     25 rootSVGElement.appendChild(path);
     26 
     27 // Setup animation test
     28 function sample1() {
     29  // Check initial/end conditions
     30  assert_animated_path_equals(path, "M 40 40 L 60 40 L 60 60 L 40 60 Z");
     31 }
     32 
     33 function sample2() {
     34  assert_animated_path_equals(path, "M 20 20 L 80 20 L 80 80 L 20 80 Z");
     35 }
     36 
     37 function sample3() {
     38  assert_animated_path_equals(
     39    path, "M 0.00999928 0.00999928 L 99.99 0.00999928 L 99.99 99.99 L 0.00999928 99.99 Z");
     40 }
     41 
     42 smil_async_test((t) => {
     43  const expectedValues = [
     44    // [animationId, time, sampleCallback]
     45    ["animation", 0.0,   sample1],
     46    ["animation", 2.0,   sample2],
     47    ["animation", 3.999, sample3],
     48    ["animation", 4.001, sample1]
     49  ];
     50  runAnimationTest(t, expectedValues);
     51 });
     52 </script>