SVG Transforms
Was trying to scale and rotate an imported SVG file using SnapJS. Couldn't get it working, then did a little digging and found that the SVG element can't accept the transform attribute. Also, the file I'm importing is only <path>
elements which also can't use the transform attribute. Solution, add all path elements to a new <g>
element and then scale that.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform#Elements
var m = new Snap.Matrix();
m.scale(0.5);
m.rotate(-20, 0, 0);
el.select('g').transform(m);
Written by mattcodez
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Svg
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#