I would like to transform an element on a SVG canvas by a transformation matrix (that is decided on the fly). I can do it with JQuery-SVG animate() but it doesn’t result smooth at all. So I thought to use the native SVG animateTransform, and the question is:
- how can I make it start when I want (maybe beginElement()), and
- how can I set the parameters from the matrix on the fly?
thanks in advance 😀
Thanks for your answer!
Since i wanted to use native SVG animations I found this solution (still not working perfectly). This is a sort of version of the unexisting animateTransform(attributeName=”transform” type=”matrix”)
NOTE: i keep the svg transformation for each element in group.transform, and group.transform.matrix() returns just the transformation matrix of that element.
I first add these elements to the element i want to animate:
Then i do:
group.transform = transformation;and finally, to update the transform attribute of the element:This final step is the problematic one. I can’t understand why with it works fine in Chrome, while the animation ends up much more scaled in Firefox and Opera (where not calling setTimeout works just fine).