Reputation: 14773
I have a lot of Raphael elements which I push into an array:
var start = function () {
this.ox = this.attr("cx");
this.oy = this.attr("cy");
},
move = function (dx, dy) {
this.attr({cx: this.ox + dx, cy: this.oy + dy});
}
for(var i = 0; i < 149; i++) {
cubes = paper.rect(Math.floor(Math.random()*2000), Math.floor(Math.random()*2000), 0, 0);
cubes.animate({ width: 25, height: 25 }, 500, "bounce");
cubesmixed.push(cubes);
cubesmixed[i].drag(move, start);
}
but unfortunatly I can't drag them. The most weird thing is, that start
and move
fire as they should. But why do they don't move.
Thanks in advance!
Upvotes: 0
Views: 121
Reputation: 3556
First of all attribute cx, cy are used in circles and elipsis so updating them will not move your rectangle which uses x and y attributes. If what you want to achieve is to move them simultanously (that was my first impression when I started to read your question - but I am not sure about that anymore :)), then please refer to this question.
Upvotes: 1