Quote:
Originally Posted by Flep
As last night I could not fall asleep :P , I decided to take a look at the Method perlinNoise of the BitmapData Class.
I created a Class which simulates the effect of the clouds over a night scene.
Stay tuned !
|
I really enjoyed this short tut since I was a bit tired of using the old style of cloud animation MoveClips.
I am wondering what your input would be on the best way to convert this into code that generates basically a blue sky w/ white clouds, more of a daytime scene than nighttime.
I started playing around w/ ColorTransform & ColorMatrixFilters, but really haven't been able to achieve the desired effect.
See below:
function initClouds():void {
bt=new BitmapData(stage.width-11,120,true,0xFFFFFF);
img = new Bitmap(bt);
img.x = 6;
img.y = 6;
addChildAt(img,17);
addEventListener(Event.ENTER_FRAME,onEnterFrame);
}
function onEnterFrame(event:Event):void{
var matrix:Array = new Array();
matrix = matrix.concat([0, 0, 0, 0, 0]); // red
matrix = matrix.concat([0, 0, 0, 0, 0]); // green
matrix = matrix.concat([0, 0, 0, .6, 0]); // blue
matrix = matrix.concat([0, 0, 0, 1, 0]); // alpha
var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix);
var filters:Array = new Array();
filters.push(filter);
var point:Point=new Point(this._offset,50);
var channels:uint = BitmapDataChannel.ALPHA;
bt.perlinNoise(300,100,2,1000,false,true,channels, false,[point,point]);
img.filters = filters;
}
I really want to lighten up the blue in the matrix incorporate some kinda of gradient w/ the bitmap so the "clouds" that are generated are rather faded from the bottom up. As can be seen in the screen shot below, I do'nt want the clouds on top of the mountains.
Thanks alot
GP