I am about to write a SMIL animation that should morph from one path to another. The paths are created by Inkscape. Although both shapes consist of 17 nodes (according to Inkscape) the SMIL animation doesn't quite work. After the defined 1 second it jumps right from one path to the other one without morphing the path between it. (Hover the border of the box) Additionally to that it also flickers in Chrome (but not in Firefox)
<svg width="34" height="34" version="1.1" viewBox="0 0 34 34" style="margin:2px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path id="check" d="m 5,8.25 0,17.5 C 5,27 6.25,27 6.25,27 l 17.5,0 c 0,0 1.25,0 1.25,-1.25 L 25,8.25 C 25,7 23.75,7 23.75,7 L 12.976695,7 6.25,7 C 6.25,7 5,7 5,8.25 Z M 2.5,2 l 25,0 c 0,0 2.5,0 2.5,2.5 l 0,25 C 30,32 27.5,32 27.5,32 l -25,0 C 2.5,32 0,32 0,29.5 L 0,4.5 C 0,2 2.5,2 2.5,2 Z" id="boxUid">
<animate attributeName="d" to="m 5,18.1 0,0 7.5,8.9 0,0 12.5,-15.7 0,0 L 23.4,7 12.5,20.8 7,14.5 Z M 2.5,2 l 25,0 c 0,0 2.5,0 2.5,2.5 l 0,25 C 30,32 27.5,32 27.5,32 l -25,0 C 2.5,32 0,32 0,29.5 L 0,4.5 C 0,2 2.5,2 2.5,2 Z" dur="1s" fill="freeze" begin="check.mouseenter"/>
<animate attributeName="d" to="m 5,8.25 0,17.5 C 5,27 6.25,27 6.25,27 l 17.5,0 c 0,0 1.25,0 1.25,-1.25 L 25,8.25 C 25,7 23.75,7 23.75,7 L 12.976695,7 6.25,7 C 6.25,7 5,7 5,8.25 Z M 2.5,2 l 25,0 c 0,0 2.5,0 2.5,2.5 l 0,25 C 30,32 27.5,32 27.5,32 l -25,0 C 2.5,32 0,32 0,29.5 L 0,4.5 C 0,2 2.5,2 2.5,2 Z" dur="1s" fill="freeze" begin="check.mouseleave"/>
</path>
</svg>
Unfortunately I'm not able to count the nodes. In principle I'm aware of how the path element works. E.g. according to MDN m dx dy
is the move command which moves to a certain position and generates a new point without connecting it to the old one. But what is m 5,18.1 0,0 7.5,8.9 0,0 12.5,-15.7 0,0
supposed to mean?
Because of apparent lack of knowledge I have to trust Inkscape which says that there are 17 nodes in each shape:
What is the reason Browsers don't do a proper animation? What do I have to change?
It seems that having the same amount of nodes in the two paths is not enough. They also have to have the same type. (e.g. straight lines vs. Bezier curves)
Here is a working example: