tor-browser

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

animate-path-animation-Qq-Tt.tentative.html (2056B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>Path animation where coordinate modes of start and end differ (Q-q and T-t)</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 -30 -30 Q 30 -30 30 0 T -30 30 Z");
     16 path.setAttribute("fill", "green");
     17 path.setAttribute("transform", "translate(50, 50)");
     18 
     19 var animate = createSVGElement("animate");
     20 animate.setAttribute("id", "animation");
     21 animate.setAttribute("attributeName", "d");
     22 animate.setAttribute("from", "M -30 -30 Q 30 -30 30 0 T -30 30 Z");
     23 animate.setAttribute("to", "M -30 -30 q 30 0 30 30 t -30 30 z");
     24 animate.setAttribute("begin", "0s");
     25 animate.setAttribute("dur", "4s");
     26 path.appendChild(animate);
     27 rootSVGElement.appendChild(path);
     28 
     29 // Setup animation test
     30 function sample1() {
     31  // Check initial/end conditions
     32  assert_animated_path_equals(path, "M -30 -30 Q 30 -30 30 0 T -30 30 Z");
     33 }
     34 
     35 function sample2() {
     36  assert_animated_path_in_array(path, [
     37    "M -30 -30 q 52.5 0 52.5 30 t -52.5 30 Z",
     38    "M -30 -30 Q 22.5 -30 22.5 0 T -30 30 Z",
     39  ]);
     40 }
     41 
     42 function sample3() {
     43  assert_animated_path_in_array(path, [
     44    "M -30 -30 q 37.5 0 37.5 30 t -37.5 30 Z",
     45    "M -30 -30 Q 7.5 -30 7.5 0 T -30 30 Z",
     46  ]);
     47 }
     48 
     49 function sample4() {
     50  assert_animated_path_in_array(path, [
     51    "M -30 -30 q 30.0075 0 30.0075 30 t -30.0075 30 Z",
     52    "M -30 -30 Q 0.01 -30 0.01 0 T -30 30 Z",
     53  ]);
     54 }
     55 
     56 smil_async_test(t => {
     57  const expectedValues = [
     58    // [animationId, time, sampleCallback]
     59    ["animation", 0.0,   sample1],
     60    ["animation", 1.0,   sample2],
     61    ["animation", 3.0,   sample3],
     62    ["animation", 3.999, sample4],
     63    ["animation", 4.001, sample1]
     64  ];
     65  runAnimationTest(t, expectedValues);
     66 });
     67 </script>