How to redraw raphael object after paper.clear()

爷,独闯天下 提交于 2019-12-25 05:08:06

问题


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);

回答1:


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.



来源:https://stackoverflow.com/questions/11114416/how-to-redraw-raphael-object-after-paper-clear

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!