Snap path circle and intersection
Lets draw a circle as a path so we can animate along it
Snap.plugin( function( Snap, Element, Paper, global ) {
Paper.prototype.circlePath = function(cx,cy,r) {
var p = "M" + cx + "," + cy;
p += "m" + -r + ",0";
p += "a" + r + "," + r + " 0 1,0 " + (r*2) +",0";
p += "a" + r + "," + r + " 0 1,0 " + -(r*2) + ",0";
return this.path(p, cx, cy );
};
});
var s = Snap("#svgout");
var cp = s.circlePath(100,100,100).attr({ fill: "none", stroke: "red" });
var cp2 = s.circlePath(150,150,100).attr({ fill: "none", stroke: "blue" });
var cp3 = s.circlePath(100,100,100).attr({ fill: "none", stroke: "green" });
var intersects = Snap.path.intersection(cp,cp2);
var intersects2 = Snap.path.intersection(cp,cp3);
intersects.forEach( function( el ) {
s.circle( el.x, el.y, 10 );
} );