如何为绘图html应用程序创建橡皮擦?

时间:2014-12-10 16:04:05

标签: javascript easeljs createjs

我是EaselJS的新手,我想创建一个橡皮擦作为画笔。这就是我用于绘图的内容,但我想用透明的方式做同样的事情。

//brush tool
var brush = new createjs.Bitmap(app.loader.getResult('brush'));
brush.name = 'brush';
brush.x = 50;
brush.y = -34;
brush.addEventListener('click', this.brushHandler);
this.toolsContainer.addChild(brush);    


this.brushSizes = new createjs.Container();
this.brushSizes.x = brush.x + 40;
this.brushSizes.y = brush.y - 20;
this.brushSizes.visible = false;
this.toolsContainer.addChild(this.brushSizes);


for(var p = 0; p < this.sizes.length; p++){
    var size = new createjs.Shape();
    size.name = 'size'+p;
    size.graphics.beginFill('#FFFFFF');
    size.graphics.drawCircle(0,0,this.sizes[p]);
    size.addEventListener('click', this.brushHandler);     
    size.x = (p==1) ? p * 40 : p * 45; 
    this.brushSizes.addChild(size);
}

0 个答案:

没有答案