Hello,
I've been playing around with svg transformations and would like to
know if you have any recommendations.
I have the need to stack several transformations on top of each other
and I've tried benchmarking SVGMatrix against my own javascript matrix
class by running a loop several thousand times like this:
for (i=0;i<maxIterations;i++){
tmp = Math.random();
matrix.scale(tmp*10).skewX(tmp*11).rotate(tmp*12).skewY(tmp*13);
}
For maxIterations < 5000 to 6000 SVGMatrix is faster than my
javascript matrix class but above the javascript version pulls ahead.
I guess it's because the SVGMatrix methods returns a new matrix when
called (and therefore triggers the carbage-collector) while my methods
alters the current matrix. So I assume that in a somewhat normal
use-case using SVGMatrix should be the best option?
Another question I have is regarding the best way to assign a svg
element a new SVGMatrix.
Is something like:
var e = document.getElementById('erect1');
e.transform.baseVal.initialize(svg.createSVGTransformFromMatrix(matrix));
faster than?:
var e = document.getElementById('erect1');
e.setAttributeNS(null,"transformation",toStringSVGMatrix(matrix));
(where toStringSVGMatrix is a function that formats the matrix into a
string)
I would like to avoid the first one as I find it ugly
I've also noticed that SVGMatrix is absent from SVG Tiny 1.2. Is doing
it yourself in javascript the only option when using SVGT 1.2?
Cheers!
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/