Loading SVG
Lets get an SVG shape loaded and displayed. We need a callback for when the file is loaded, then we can add it to our canvas.
Note, it gets loaded into Snap as a fragment.
Note, it gets loaded into Snap as a fragment.
// Bird image is from creative commons, I didn't create it!
var s = Snap("#svgout");
var bird = Snap.load("bird.svg", function ( loadedFragment ) {
var b = s.append( loadedFragment );
var bbox = b.getBBox();
var vbox = bbox.x + " " + bbox.y + " " + bbox.width + " " + bbox.height;
s.attr({ viewBox: vbox });
} );