Easy Move!

by Nathan Woods

HTML

<div id="canvas"></div>

JavaScript

var R = Raphael("canvas", 500, 500);    
R.setStart();
R.circle(200, 200, 50).attr({
    fill: "hsb(.8, 1, 1)",
    stroke: "none",
    opacity: .5
});
R.rect(100, 100, 50, 50).attr({
    fill: "hsb(.8, 1, 1)",
    stroke: "none",
    opacity: .5
});
var c = R.setFinish()

// just drag all elements of set
c.drag(function(dx, dy){
    this.transform(this.orig+'T'+dx+','+dy); 
}, function(){
    this.orig = this.transform();
});