JS SVG getCTM and setCTM?
javascript, svg
Solution
var transform = ownerSVGElement.createSVGTransform()
transform.setMatrix(elem.getCTM())
someelement.transform.baseVal.initialize(transform)
Problem
If I use getCTM() to get the current tranformation matrix, how do I use that object to set the matrix if I want to restore it at a later point (I know about save and restore but those refer to the canvas and not items) I know I set the attribute: ``` var m = someitem.getCTM(); $(someitem).attr("transform", "matrix("+m.a+","+m.b+","+m.c+","+ m.d+","+m.e+","+m.f+")"); ``` But that seems sort of a long way of doing it. I can't find a setCTM function of any such close function. Developing for webkit if that makes a difference. Thanks!