I have a number of circles that i'm using as draggable buttons, i can assign drag events to these and it works correctly, but i want to clone AND drag them, so i end up with multiple buttons (as many as needed). How do i clone and then drag the cloned object?
This is what i have
var a = r.circle(20, 50, 15)
// drag handler
var start = function(x,y,event) {
this.ox = this.attr("cx");
this.oy = this.attr("cy");
this.animate({r: 20, opacity: .25}, 500, ">");
},
move = function(dx, dy) {
this.attr({cx: this.ox + dx, cy: this.oy + dy});
},
up = function () {
this.animate({r: 15, opacity: .5}, 500, ">");
};
a.drag(move, start, up);
I have tried various things, cloning 'a', cloning 'this' in start, but my js knowledge is limited so any help would be appreciated.
Thanks!