我可以制作一个obj使用画布绘制如下:
MyObj.myDiv = new Canvas($("effectDiv"), Setting.width, Setting.height);
然后,我使用它在画布上绘制一个矩形:
var c = new Rectangle(80, 80, { fill: [220, 40, 90] } ); var move = new Timeline; move.addKeyframe(0, { x: 0, y: 0 } ); c.addTimeline(move); MyObj.myDiv.append(c);
但是在绘制矩形后,我想要清除画布,但我不知道哪种方法以及如何做到这一点......
O ...还有一件事:它是CAKE的网站: 链接
清除画布:
canvas.clear = true; // makes the canvas clear itself on every frame canvas.fill = somecolor; // fills the canvas with some color on every frame // with canvas.clear = false and low-opacity fill, fancy motion blur effect Removing the rectangle from the canvas: rectangle.removeSelf(); or canvas.removeChild(rectangle);