Describe the bug
https://codesandbox.io/s/framer-motion-motion-along-a-path-41i3v
I wanted to do something similar to the code in this sandbox, but rather than running a div along the path I wanted to run an svg rect along the path. When adding offsetDistance to an svg element it renders offset-distance as a property on the rect, rather than adding it to the style tags, which is not valid and does not work.
Even if you add offsetDistance as a property of the style object, it removes it from the style tags and adds it to the rect. However, this only seems to happen with a MotionValue. if you hardcode an offsetDistance on the style tags it works properly.
Steps to reproduce
https://codesandbox.io/s/framer-motion-motion-along-a-path-forked-r6u87
Steps to reproduce the behavior:
- Go into the forked sandbox and see the three circles I have added.
- The red circle uses the same method of animation as the div in the original sandbox, but upon inspecting the HTML you will see the
offset-distance is applied to the root of the circle which is invalid.
- The orange circle is an alternative method of animating using useMotionValue and applying the value directly to the style tags, but upon inspecting the HTML you will see the
offset-distance is applied to the root of the circle which is invalid.
- The green circle is not animated, but has a hardcoded
'50%' on the style tags offsetDistance this applies the offset-distance to the style tags properly and shows the circle to be moved 50% along the path.
Expected behavior
Animating offsetDistance on an svg element should apply the property to the style tags so it animates properly in the same way it does for a div.