Skip to content
Advertisement

updating SVG animateMotion path using JavaScript

I try changing an SVG motion path according to a html select value using JS. The path updates as expected, but the element, which uses the path as a motion path continues to move along the original path. What am I missing?

JavaScript
JavaScript
JavaScript

Advertisement

Answer

As Danny mentioned in his answer the mpath is using the untransformed path. If you need it to be transformed you can wrap both the path and the animated rect in a group and transform the group.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement