Snap Docs

Moving Snap stuff

Now lets Move stuff. We can use 'transform' (or we could set the attr of x,y or cx,cy, but transforms are the same for all elements, so worth getting to know well)


var s = Snap("#svgout"); 

//lets draw 2 rects at position 100,100 and then reposition them

var r = s.rect(100,100,100,100,20,20).attr({ stroke: '#123456', 'strokeWidth': 20, fill: 'red', 'opacity': 0.2 });

r.drag();     // just so we can drag it about
   
	
SVGout area...
The actual svg markup looks like this (when you've clicked on run)....