Click Handler starting animation
Heres an example click handler starting an animation
var s = Snap("#svgout");
var r = s.rect(100,100,100,100,20,20).attr({ stroke: '#123456', 'strokeWidth': 20, fill: 'red' });
var c = s.circle(50,50,50).attr({ stroke: '#123456', 'strokeWidth': 20, fill: 'blue' });
var otherRect = s.rect(200,200,50,50,10,10).attr({ stroke: '#123456', 'strokeWidth': 20, fill: 'green' });
var g = s.group(r,c);
var clickFunc = function () {
g.transform(''); // reset the animation, may not be needed
otherRect.transform('');
g.animate({ transform: 'r45,150,150' }, 1000, mina.bounce ) ;;
otherRect.animate({ transform: 'r360, 150,150' },2000, mina.bounce, endAnim );
};
var endAnim = function() {
otherRect.animate({ transform: 'r90,200,200' }, 2000, mina.bounce );
}
g.click( clickFunc );