animate-path-animation-Ll-Vv-Hh.tentative.html (2005B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Path animation where coordinate modes of start and end differ (L-l, V-v and H-h)</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 L 30 0 V 30 H 0 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 L 30 0 V 30 H 0 Z"); 23 animate.setAttribute("to", "M 30 30 l -60 -30 v -30 h 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 L 30 0 V 30 H 0 Z"); 33 } 34 35 function sample2() { 36 assert_animated_path_in_array(path, [ 37 "M -15 -15 l 30 15 v 15 h -15 Z", 38 "M -15 -15 L 15 0 V 15 H 0 Z", 39 ]); 40 } 41 42 function sample3() { 43 assert_animated_path_in_array(path, [ 44 "M 15 15 l -30 -15 v -15 h 15 Z", 45 "M 15 15 L -15 0 V -15 H 0 Z", 46 ]); 47 } 48 49 function sample4() { 50 assert_animated_path_in_array(path, [ 51 "M 29.985 29.985 l -59.97 -29.985 v -29.985 h 29.985 Z", 52 "M 29.98 29.98 L -29.98 0 V -29.98 H 0 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>