Can you add code to this class to draw lines continuously?
This is a package for a simple brush on the Swf output. When the mouse moves fast, there are gaps between points. That is, it becomes a point. Can you add code to this class to draw lines continuously?
package tools {
import flash.display.*;
import flash.geom.*;
public class BrushTool implements ITool {
private var _bitmap:Bitmap;
private var _bmd:BitmapData;
private var _brushStroke:Shape;
public function BrushTool() {
_bmd = new BitmapData(680, 580, true, 0x00000000);
_bitmap = new Bitmap(_bmd);
}
public function mouseDown(x:Number, y:Number, fillColor:uint):void {
_brushStroke = new Shape();
var gradBox:Matrix = new Matrix();
gradBox.createGradientBox(10, 10, 0, 0, 0);
_brushStroke.graphics.beginGradientFill(GradientType.RADIAL, [fillColor, fillColor], [1, 0], [127,255], gradBox)
_brushStroke.graphics.drawCircle(10, 10, 10);
}
public function mouseMove(x:Number, y:Number):void {
var m:Matrix = new Matrix();
m.translate(x-10, y-10)
_bmd.draw(_brushStroke, m);
}
public function mouseUp(x:Number, y:Number):void {
}
public function get art():DisplayObject {
return _bitmap;
}
}
}
question from:
https://stackoverflow.com/questions/65849570/as3-fixed-the-problem-of-empty-spaces-between-points-in-the-class-brush 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…