Charcoal and crayon drawing effect.
I am currently exploring how to apply a charcoal or crayon effect to a pen tool.
To revisit the code for a generic draw tool in AS 3.0:
Quote:
var drawing:Boolean=false;
this.graphics.lineStyle(1,0x000000);
this.graphics.moveTo(mouseX, mouseY);
this.addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, onUp, false, 0, true);
function onDown(evt:MouseEvent):void {
drawing=true;
}
function onUp(evt:MouseEvent):void {
drawing=false;
}
function onLoop(evt:Event):void{
if(drawing){
this.graphics.lineTo(mouseX, mouseY);
}else{
this.graphics.moveTo(mouseX, mouseY);
}
}
I still haven't found code that allows a sort of "rubber stamp" that I think would give that result. -meaning -I create a vector symbol in flash that resembles the shape of the "brush" and as it gets dragged -it actually would repeat itself . So.... what I think should happen is a graphic from the library would repeat itself with MOUSE_DOWN and x/y being traced - I THINK that is the right approach to make it work, albeit I would have to set the movie for a high frame rate.
any links to as 3.0 examples of that being done?
AS 3.0 version of that still trying
I have been messing around with an as 3 version that works with the xample you showed me.
I'm still playing around any ideas?
Quote:
/*
var drawing :Boolean = false;
var inc:uint = 0;
this.graphics.moveTo(mouseX,mouseY);
stage.addEventListener(MouseEvent.MOUSE_DOWN, paintMe, false, 0, true);
this.addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
function paintMe(evt:MouseEvent):void{
drawing=true;
var ball:MovieClip = new Ball();
addChild(ball);
inc++;
}
function onLoop(evt:EVENT):void{
if (drawing)
{this.graphics.moveTo(mouseX,mouseY);}
}