Harshal Chauhari
Harshal Chauhari

Reputation: 91

How to redraw raphael object after paper.clear()

This is my code. i have tried but cant find any answer. so anyone help me

  move = function (dx, dy) {
                paper.clear();
                this.attr({x: this.ox + dx, y: this.oy + dy});
                    var arrow = paper.arrow(this.ox,this.oy,this.attrs.x,this.attrs.y,8);


                }
          rect2.drag(move, start);

Upvotes: 0

Views: 2322

Answers (1)

amadan
amadan

Reputation: 1514

I don't think you need to be clearing (unless you have a specific reason for doing so...). Raphael isn't like drawing on the html5 canvas; you don't need to clear and redraw everything when you want to animate. Each element within Raphael (and SVG) is an object in and of itself. Changing the centre of a circle will automatically update where that circle is in your drawing.

As long as you have a handle to the object you can manipulate it to your hearts content without having to request it be redrawn.

Upvotes: 3

Related Questions