Using a Mask in Snap

Draw a big circle as a mask and animate objects

var s = Snap("#svgout");

var bigC =,200,175).attr({ stroke: 'silver', 'strokeWidth': 40, fill: 'silver' });

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

var g =,c);

g.attr({ mask: bigC });

g.animate({ transform: 'r360,150,150' }, 1000, mina.bounce );


The actual svg markup looks like this (when you've clicked on run)....