Raphael :: Introductory Tutorial

Based on tutorial at http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/

HTML

<div id="canvas_container"></div>

JavaScript

var paper = new Raphael(document.getElementById('canvas_container'), 500, 500);
debugger;
var x=120,y=100;
var temp = paper.set();
for(i=0; i<6; i++){
    
var circle = paper.circle(x,y,10);
    y=y+50;
  temp.push(circle); 
    circle.attr({
fill:Raphael.getColor()   
});
} 


    temp[i-1].node.onclick = function() {
        for(var a=4; a<i;a++){
   debugger;
    temp[a-2].animate({opacity: 0}, 100, function() {
       this.remove();
        
    });}
}