Yesterday night I wanted to have some “no-purpose coding session” and thought it was a nice idea to record the session and do a speedcoding video. The original video has been collapsed from 45 minutes to 3 minutes circa.
The main concept is once again based on perlinNoise which (I am sure you already guessed) is something I do like very much. So please start call me “The PerlinNoise Guy” or “Perlinator”.
So this is my first speedcoding video (be sure to look at it in high quality):
Here’s the interactive demo:

Click to launch. Move mouse (x position) to change smoothness (my favourite values are around 100)
The code consist on a Branch.as class file (click to download) and some timeline code to assemble the demo:
import com.oaxoa.fx.Branch; const w:uint=stage.stageWidth; const h:uint=stage.stageHeight; var ct:ColorTransform=new ColorTransform(1,1,1,1,1,1,1); var renderView:BitmapData=new BitmapData(w, h, true); var bmp:Bitmap=new Bitmap(renderView); addChild(bmp); var tf:TextFormat=new TextFormat("_sans", 16, 0, true); var label:TextField=new TextField(); label.width=400; label.defaultTextFormat=tf; addChild(label); var timer:Timer=new Timer(10); timer.addEventListener(TimerEvent.TIMER, ontimer); timer.start(); function ontimer(event:TimerEvent):void { addNew(); } function addNew():void { label.text="Smoothness: "+String(mouseX-w/2); var tt:Branch=new Branch(mouseX-w/2); tt.x=stage.stageWidth/2; tt.y=stage.stageHeight/2; tt.addEventListener(Event.COMPLETE, oncomplete); addChild(tt); renderView.colorTransform(renderView.rect, ct); } function oncomplete(event:Event):void { var t:Branch=event.currentTarget as Branch; var matrix:Matrix=new Matrix(); matrix.translate(t.x, t.y); renderView.draw(t, matrix); removeChild(t); t.removeEventListener(Event.COMPLETE, oncomplete); t=null; }
I didn’t forget about the lightning class part 3 that I will publish soon
As usual if you liked this drop a line in the comments.
Ciao



















This blog is about actionscript 3, Flex and Adobe AIR developing and fun.
I am Pierluigi Pesenti (aka Panta) and here I post my experiments and classes done in my little spare time.
Hope You'll enjoy it and leave some comment. Also don't forget to subscribe to my feed if you want to keep updated about new posts.
