Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

SVG Preview (Scaled)

Preview of https://hg.mozilla.org/mozilla-central/raw-file/tip/testing/web-platform/tests/svg/types/scripted/SVGGeometryElement.getPointAtLength-02.svg
<title>SVGGeometryElement.prototype.getPointAtLength() query with 'pathLength'</title>
<path id='pathElement' d='M0,0L100,0L100,100' pathLength="1000"/>
<h:script src="/resources/testharness.js"/>
<h:script src="/resources/testharnessreport.js"/>
<script>
test(function() {
let path = document.getElementById('pathElement');
var point = path.getPointAtLength(50);
assert_approx_equals(point.x, 50, 1e-5);
assert_approx_equals(point.y, 0, 1e-5);
var point = path.getPointAtLength(150);
assert_approx_equals(point.x, 100, 1e-5);
assert_approx_equals(point.y, 50, 1e-5);
});
</script>
</svg>