Line Bitmap drawing with Tweener Bezier

| 9 min read

After having a look at the tutorial from Lee Brimelow, I used it to make some experiments.

I tried to find a way to draw a moving line on a bezier curve, like a snake. I didn't really reached it. If you have some ideas how to get a "snake line", please let me know.

I used Tweener to animate.

Draw 1 (demo)

Just a simple drawing, a line on moving canvas. Here is the code:

/*
* Class
*
* Copyright info: Free to use and change, an notification email will be welcome for a commercial use
* Actionscript: built for actionscript 3.0 and flash player 9
* Date: 01-2008
*
* @author Romuald Quantin - romu@soundstep.com - www.soundstep.com
* @version 1.0
* @usage
*
*/


package {

import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.ui.*;
import caurina.transitions.Tweener;

public class Draw1 extends Sprite {

//------------------------------------
// private properties
//------------------------------------

private var _canvas:Sprite;
private var _obj:Object;


//------------------------------------
// public properties
//------------------------------------



//------------------------------------
// constructor
//------------------------------------

public function Draw1() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.frameRate = 81;
_obj = {};
_obj.x = stage.stageWidth * .5;
_obj.y = stage.stageHeight * .5;
createCanvas();
}

//
// PRIVATE
//________________________________________________________________________________________________

private function createCanvas(width:int = 500, height:int = 400):void {
_canvas = new Sprite();
cacheAsBitmap = true;
_canvas.cacheAsBitmap = true;
_canvas.graphics.lineStyle(3, Math.random() * 0xFFFFFF, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
_canvas.graphics.moveTo(_obj.x, _obj.y);
addChild(_canvas);
_canvas.addEventListener(Event.ENTER_FRAME, loop);
randomTween(getRandomData());
}

private function loop(e:Event):void {
_canvas.x -= 4;
var p:Point = _canvas.globalToLocal(new Point(_obj.x, _obj.y));
_canvas.graphics.lineTo(p.x, p.y);
}

private function randomTween(o:Object):void {
Tweener.addTween(_obj, {y:o.y, time:o.time, transition:"easeInOutElastic", onComplete:
function():void {
randomTween(getRandomData());
}
});
}

private function getRandomData():Object {
var o:Object = {};
o.y = Math.round(Math.random() * stage.stageHeight);
o.time = Math.random() * 3 + 1;
return o;
}

// PUBLIC
//________________________________________________________________________________________________


}

}

Draw 2 (demo)

The second one I draw 5 lines contained in a circle. I used the bezier property of Tweener to build the curves. So I first draw the curve on a bitmapdata canvas and then use a color matrix filter to fade the line after each drawing.

/*
* Class
*
* Copyright info: Free to use and change, an notification email will be welcome for a commercial use
* Actionscript: built for actionscript 3.0 and flash player 9
* Date: 01-2008
*
* @author Romuald Quantin - romu@soundstep.com - www.soundstep.com
* @version 1.0
* @usage
*
*/


package {

import flash.display.*;
import flash.events.*;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.*;
import flash.ui.*;
import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;

public class Draw2 extends Sprite {

//------------------------------------
// private properties
//------------------------------------

private var _lineNum:uint = 5;
private var _pointNum:uint = 5;
private var _lineArray:Array = [];
private var _objArray:Object = [];
private var _maxRadius:Number = 150;

private var _cmf:ColorMatrixFilter;
private var _bf:BlurFilter;

//------------------------------------
// public properties
//------------------------------------

private var _bmd:BitmapData;

//------------------------------------
// constructor
//------------------------------------

public function Draw2() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.frameRate = 41;
CurveModifiers.init();
//graphics.beginFill(0x222222);
//graphics.drawCircle((stage.stageWidth * .5), (stage.stageHeight * .5), _maxRadius);
_cmf = new ColorMatrixFilter([1,0,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,.5,0]);
_bf = new BlurFilter(8, 8, 3);
createCanvas();
createLines();
}

//
// PRIVATE
//________________________________________________________________________________________________

public function createCanvas():void {
_bmd = new BitmapData(550, 400, true, 0x000000);
var bm:Bitmap = new Bitmap(_bmd);
addChild(bm);
}

private function createLines():void {
for (var i:uint = 0; i < _lineNum; i++) {
var obj:Object = { };
obj.color = Math.random() * 0xFF0000;
obj.x = getRandomPos().x;
obj.y = getRandomPos().y;
_objArray.push(obj);
var l:Sprite = new Sprite();
//l.filters = [new BlurFilter(2, 2, 3)]
l.name = "line" + i;
l.graphics.lineStyle(3, Math.random() * obj.color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
addChild(l);
_lineArray.push(l);
randomTween(getRandomData(obj, l), l);
}
addEventListener(Event.ENTER_FRAME, loop);
}

private function loop(e:Event):void {
for (var i = 0; i < _lineNum; i++) {
_lineArray[i].graphics.lineTo(_objArray[i].x, _objArray[i].y);
}
_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _cmf);
//_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _bf);
_bmd.draw(this);
}

private function randomTween(o:Object, line:Sprite):void {
line.graphics.clear();
line.graphics.lineStyle(3, o.color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
line.graphics.moveTo(o.x, o.y);
Tweener.addTween(o, { x:o.x1, y:o.y1, _bezier:o.bezier, time:o.time, transition:"easeInOutQuad", onComplete:
function():void {
randomTween(getRandomData(o, line), line);
}
});
}

private function getRandomData(obj:Object, line:Sprite):Object {
obj.time = Math.random() * 2 + .8;
obj.x1 = getRandomPos().x;
obj.y1 = getRandomPos().y;
obj.bezier = [];
for (var i = 0; i < _pointNum; i++) {
obj.bezier.push({
x:getRandomPos().x,
y:getRandomPos().y
});
}
return obj;
}

private function getRandomPos():Object {
var o:Object = {}
o.x = Math.cos(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageWidth * .5);
o.y = Math.sin(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageHeight * .5);
return o;
}

// PUBLIC
//________________________________________________________________________________________________


}

}

Draw 3 (demo)

In this one, the technic is slightly different. I now update the drawing in the frame loop and use the color matrix filter to leave a trail.

/*
* Class
*
* Copyright info: Free to use and change, an notification email will be welcome for a commercial use
* Actionscript: built for actionscript 3.0 and flash player 9
* Date: 01-2008
*
* @author Romuald Quantin - romu@soundstep.com - www.soundstep.com
* @version 1.0
* @usage
*
*/


package {

import flash.display.*;
import flash.events.*;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.*;
import flash.ui.*;
import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;

public class Draw3 extends Sprite {

//------------------------------------
// private properties
//------------------------------------

private var _lineNum:uint = 5;
private var _pointNum:uint = 40;
private var _lineArray:Array = [];
private var _objArray:Object = [];
private var _maxRadius:Number = 150;

private var _cmf:ColorMatrixFilter;
private var _bf:BlurFilter;

//------------------------------------
// public properties
//------------------------------------

private var _bmd:BitmapData;

//------------------------------------
// constructor
//------------------------------------

public function Draw3() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.frameRate = 41;
CurveModifiers.init();
_cmf = new ColorMatrixFilter([1,0,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,.5,0]);
_bf = new BlurFilter(8, 8, 3);
createCanvas();
createLines();
}

//
// PRIVATE
//________________________________________________________________________________________________

public function createCanvas():void {
_bmd = new BitmapData(550, 400, true, 0x000000);
var bm:Bitmap = new Bitmap(_bmd);
addChild(bm);
}

private function createLines():void {
for (var i:uint = 0; i < _lineNum; i++) {
var obj:Object = { };
obj.color = Math.random() * 0xFF0000;
obj.x = obj.prevX = getRandomPos().x;
obj.y = obj.prevY = getRandomPos().y;
_objArray.push(obj);
var l:Sprite = new Sprite();
//l.filters = [new BlurFilter(2, 2, 3)]
l.name = "line" + i;
l.graphics.lineStyle(3, Math.random() * obj.color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
addChild(l);
_lineArray.push(l);
randomTween(getRandomData(obj, l), l);
}
addEventListener(Event.ENTER_FRAME, loop);
}

private function loop(e:Event):void {
for (var i = 0; i < _lineNum; i++) {
_lineArray[i].graphics.clear();
_lineArray[i].graphics.lineStyle(3, _objArray[i].color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
_lineArray[i].graphics.moveTo(_objArray[i].prevX, _objArray[i].prevY);
_lineArray[i].graphics.lineTo(_objArray[i].x, _objArray[i].y);
_objArray[i].prevX = _objArray[i].x;
_objArray[i].prevY = _objArray[i].y;
}
_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _cmf);
//_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _bf);
_bmd.draw(this);
}

private function randomTween(o:Object, line:Sprite):void {
Tweener.addTween(o, { x:o.x1, y:o.y1, _bezier:o.bezier, time:o.time, transition:"linear", onComplete:
function():void {
randomTween(getRandomData(o, line), line);
}
});
}

private function getRandomData(obj:Object, line:Sprite):Object {
obj.time = Math.random() * 8 + 12;
obj.x1 = getRandomPos().x;
obj.y1 = getRandomPos().y;
obj.bezier = [];
for (var i = 0; i < _pointNum; i++) {
obj.bezier.push({
x:getRandomPos().x,
y:getRandomPos().y
});
}
return obj;
}

private function getRandomPos():Object {
var o:Object = {}
o.x = Math.cos(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageWidth * .5);
o.y = Math.sin(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageHeight * .5);
return o;
}

// PUBLIC
//________________________________________________________________________________________________


}

}

Draw 4 (demo)

Just a bit of fun on the second experiment with a blur filter, pretty nice if you like techno style :)

/*
* Class
*
* Copyright info: Free to use and change, an notification email will be welcome for a commercial use
* Actionscript: built for actionscript 3.0 and flash player 9
* Date: 01-2008
*
* @author Romuald Quantin - romu@soundstep.com - www.soundstep.com
* @version 1.0
* @usage
*
*/


package {

import flash.display.*;
import flash.events.*;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.*;
import flash.ui.*;
import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;

public class Draw4 extends Sprite {

//------------------------------------
// private properties
//------------------------------------

private var _lineNum:uint = 5;
private var _pointNum:uint = 5;
private var _lineArray:Array = [];
private var _objArray:Object = [];
private var _maxRadius:Number = 150;

private var _cmf:ColorMatrixFilter;
private var _bf:BlurFilter;

//------------------------------------
// public properties
//------------------------------------

private var _bmd:BitmapData;
private var _bm:Bitmap;

//------------------------------------
// constructor
//------------------------------------

public function Draw4() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.frameRate = 41;
CurveModifiers.init();
btReload.addEventListener(MouseEvent.CLICK, reload);
_cmf = new ColorMatrixFilter([1,0,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,1,0]);
_bf = new BlurFilter(6, 6, 2);
createCanvas();
createLines();
}

//
// PRIVATE
//________________________________________________________________________________________________

public function createCanvas():void {
_bmd = new BitmapData(550, 400, true, 0x000000);
_bm = new Bitmap(_bmd);
addChild(_bm);
}

private function createLines():void {
for (var i:uint = 0; i < _lineNum; i++) {
var obj:Object = { };
obj.color = Math.random() * 0xFF0000;
obj.x = getRandomPos().x;
obj.y = getRandomPos().y;
_objArray.push(obj);
var l:Sprite = new Sprite();
l.filters = [new BlurFilter(3, 3, 2)]
l.name = "line" + i;
l.graphics.lineStyle(3, Math.random() * obj.color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
addChild(l);
_lineArray.push(l);
randomTween(getRandomData(obj, l), l);
}
addEventListener(Event.ENTER_FRAME, loop);
}

private function loop(e:Event):void {
for (var i = 0; i < _lineNum; i++) {
_lineArray[i].graphics.lineTo(_objArray[i].x, _objArray[i].y);
}
_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _cmf);
_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _bf);
_bmd.draw(this);
}

private function randomTween(o:Object, line:Sprite):void {
line.graphics.clear();
line.graphics.lineStyle(3, o.color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
line.graphics.moveTo(o.x, o.y);
Tweener.addTween(o, { x:o.x1, y:o.y1, _bezier:o.bezier, time:o.time, transition:"linear", onComplete:
function():void {
randomTween(getRandomData(o, line), line);
}
});
}

private function getRandomData(obj:Object, line:Sprite):Object {
obj.time = Math.random() * 2 + .8;
obj.x1 = getRandomPos().x;
obj.y1 = getRandomPos().y;
obj.bezier = [];
for (var i = 0; i < _pointNum; i++) {
obj.bezier.push({
x:getRandomPos().x,
y:getRandomPos().y
});
}
return obj;
}

private function getRandomPos():Object {
var o:Object = {}
o.x = Math.cos(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageWidth * .5);
o.y = Math.sin(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageHeight * .5);
return o;
}

// PUBLIC
//________________________________________________________________________________________________

public function reload(e:MouseEvent = null):void {
Tweener.removeAllTweens();
removeEventListener(Event.ENTER_FRAME, loop);
for (var i:uint = 0; i < _lineNum; i++) {
removeChild(_lineArray[i]);
}
removeChild(_bm);
_objArray = [];
_lineArray = [];
createCanvas();
createLines();
}

}

}

Draw 5 (demo)

This one is mixing the colors and creating a shape little by little.

/*
* Class
*
* Copyright info: Free to use and change, an notification email will be welcome for a commercial use
* Actionscript: built for actionscript 3.0 and flash player 9
* Date: 01-2008
*
* @author Romuald Quantin - romu@soundstep.com - www.soundstep.com
* @version 1.0
* @usage
*
*/


package {

import flash.display.*;
import flash.events.*;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.*;
import flash.ui.*;
import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;

public class Draw5 extends Sprite {

//------------------------------------
// private properties
//------------------------------------

private var _lineNum:uint = 5;
private var _pointNum:uint = 10;
private var _lineArray:Array = [];
private var _objArray:Object = [];
private var _maxRadius:Number = 150;

private var _cmf:ColorMatrixFilter;
private var _bf:BlurFilter;

//------------------------------------
// public properties
//------------------------------------

private var _bmd:BitmapData;
private var _bm:Bitmap;

//------------------------------------
// constructor
//------------------------------------

public function Draw5() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.frameRate = 41;
CurveModifiers.init();
btReload.addEventListener(MouseEvent.CLICK, reload);
_cmf = new ColorMatrixFilter([1.1,0,0,0,0,
0,1.1,0,0,0,
0,0,1.1,0,0,
0,0,0,.585,0]);
_bf = new BlurFilter(5, 5, 2);
createCanvas();
createLines();
}

//
// PRIVATE
//________________________________________________________________________________________________

public function createCanvas():void {
_bmd = new BitmapData(550, 400, true, 0x000000);
_bm = new Bitmap(_bmd);
addChild(_bm);
}

private function createLines():void {
for (var i:uint = 0; i < _lineNum; i++) {
var obj:Object = { };
obj.color = Math.random() * 0xFF0000;
obj.x = obj.prevX = getRandomPos().x;
obj.y = obj.prevY = getRandomPos().y;
_objArray.push(obj);
var l:Sprite = new Sprite();
l.filters = [new BlurFilter(2, 2, 2)]
l.name = "line" + i;
l.graphics.lineStyle(3, Math.random() * obj.color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
addChild(l);
_lineArray.push(l);
randomTween(getRandomData(obj, l), l);
}
addEventListener(Event.ENTER_FRAME, loop);
}

private function loop(e:Event):void {
for (var i = 0; i < _lineNum; i++) {
_lineArray[i].graphics.clear();
_lineArray[i].graphics.lineStyle(3, _objArray[i].color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
_lineArray[i].graphics.moveTo(_objArray[i].prevX, _objArray[i].prevY);
_lineArray[i].graphics.lineTo(_objArray[i].x, _objArray[i].y);
_objArray[i].prevX = _objArray[i].x;
_objArray[i].prevY = _objArray[i].y;
}
_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _cmf);
_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _bf);
_bmd.draw(this);
}

private function randomTween(o:Object, line:Sprite):void {
Tweener.addTween(o, { x:o.x1, y:o.y1, _bezier:o.bezier, time:o.time, transition:"linear", onComplete:
function():void {
randomTween(getRandomData(o, line), line);
}
});
}

private function getRandomData(obj:Object, line:Sprite):Object {
obj.time = Math.random() * 3 + 3;
obj.x1 = getRandomPos().x;
obj.y1 = getRandomPos().y;
obj.bezier = [];
for (var i = 0; i < _pointNum; i++) {
obj.bezier.push({
x:getRandomPos().x,
y:getRandomPos().y
});
}
return obj;
}

private function getRandomPos():Object {
var o:Object = {}
o.x = Math.cos(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageWidth * .5);
o.y = Math.sin(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageHeight * .5);
return o;
}

// PUBLIC
//________________________________________________________________________________________________

public function reload(e:MouseEvent = null):void {
Tweener.removeAllTweens();
removeEventListener(Event.ENTER_FRAME, loop);
for (var i:uint = 0; i < _lineNum; i++) {
removeChild(_lineArray[i]);
}
removeChild(_bm);
_objArray = [];
_lineArray = [];
createCanvas();
createLines();
}

}

}

Draw 6 (demo)

Almost the same test but I move the bitmapdata layer.

/*
* Class
*
* Copyright info: Free to use and change, an notification email will be welcome for a commercial use
* Actionscript: built for actionscript 3.0 and flash player 9
* Date: 01-2008
*
* @author Romuald Quantin - romu@soundstep.com - www.soundstep.com
* @version 1.0
* @usage
*
*/


package {

import flash.display.*;
import flash.events.*;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.*;
import flash.ui.*;
import caurina.transitions.Tweener;
import caurina.transitions.properties.CurveModifiers;

public class Draw6 extends Sprite {

//------------------------------------
// private properties
//------------------------------------

private var _lineNum:uint = 5;
private var _pointNum:uint = 40;
private var _lineArray:Array = [];
private var _objArray:Object = [];
private var _maxRadius:Number = 150;

private var _cmf:ColorMatrixFilter;
private var _bf:BlurFilter;

//------------------------------------
// public properties
//------------------------------------

private var _bmd:BitmapData;
private var _bm:Bitmap;

//------------------------------------
// constructor
//------------------------------------

public function Draw6() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.frameRate = 41;
CurveModifiers.init();
btReload.addEventListener(MouseEvent.CLICK, reload);
_cmf = new ColorMatrixFilter([1.1,0,0,0,0,
0,1.1,0,0,0,
0,0,1.1,0,0,
0,0,0,.66,0]);
_bf = new BlurFilter(8, 8, 2);
createCanvas();
createLines();
}

//
// PRIVATE
//________________________________________________________________________________________________

public function createCanvas():void {
_bmd = new BitmapData(800, 400, true, 0x000000);
_bm = new Bitmap(_bmd);
addChild(_bm);
}

private function createLines():void {
for (var i:uint = 0; i < _lineNum; i++) {
var obj:Object = { };
obj.color = Math.random() * 0xFF0000;
obj.x = obj.prevX = getRandomPos().x;
obj.y = obj.prevY = getRandomPos().y;
_objArray.push(obj);
var l:Sprite = new Sprite();
l.filters = [new BlurFilter(2, 2, 2)]
l.name = "line" + i;
l.graphics.lineStyle(3, Math.random() * obj.color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
addChild(l);
_lineArray.push(l);
randomTween(getRandomData(obj, l), l);
}
addEventListener(Event.ENTER_FRAME, loop);
}

private function loop(e:Event):void {
for (var i = 0; i < _lineNum; i++) {
_lineArray[i].graphics.clear();
_lineArray[i].graphics.lineStyle(3, _objArray[i].color, 1, false, LineScaleMode.NONE, CapsStyle.ROUND);
_lineArray[i].graphics.moveTo(_objArray[i].prevX, _objArray[i].prevY);
_lineArray[i].graphics.lineTo(_objArray[i].x, _objArray[i].y);
_objArray[i].prevX = _objArray[i].x;
_objArray[i].prevY = _objArray[i].y;
}
_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _cmf);
_bmd.applyFilter(_bmd, _bmd.rect, new Point(0, 0), _bf);
_bmd.draw(this);
_bmd.scroll(-4, 0);
}

private function randomTween(o:Object, line:Sprite):void {
Tweener.addTween(o, { x:o.x1, y:o.y1, _bezier:o.bezier, time:o.time, transition:"linear", onComplete:
function():void {
randomTween(getRandomData(o, line), line);
}
});
}

private function getRandomData(obj:Object, line:Sprite):Object {
obj.time = Math.random() * 8 + 12;
obj.x1 = getRandomPos().x;
obj.y1 = getRandomPos().y;
obj.bezier = [];
for (var i = 0; i < _pointNum; i++) {
obj.bezier.push({
x:getRandomPos().x,
y:getRandomPos().y
});
}
return obj;
}

private function getRandomPos():Object {
var o:Object = {}
o.x = Math.cos(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageWidth * .5 + 200);
o.y = Math.sin(Math.random() * (Math.PI * 2)) * (Math.sqrt(Math.random()) * _maxRadius) + (stage.stageHeight * .5);
return o;
}

// PUBLIC
//________________________________________________________________________________________________

public function reload(e:MouseEvent = null):void {
Tweener.removeAllTweens();
removeEventListener(Event.ENTER_FRAME, loop);
for (var i:uint = 0; i < _lineNum; i++) {
removeChild(_lineArray[i]);
}
removeChild(_bm);
_objArray = [];
_lineArray = [];
createCanvas();
createLines();
}

}

}

Source

You can download the source here.

More links

More details on the Tweener bezier curve and the color matrix filter use.

Tweener bezier

Abobe matrix

Grant Skinner matrix

Gimp doc