forked from: Perlin Noise Fire
// forked from runouw's Perlin Noise Fire
package {
import flash.display.*;
import flash.events.*;
import flash.filters.*
import flash.geom.*
public class FlashTest extends Sprite {
[SWF(frameRate="60")]
public var bmd:BitmapData;
public var bitmap:Bitmap;
public var bmd2:BitmapData;
public var bitmap2:Bitmap;
public function FlashTest() {
bmd = new BitmapData(465,465,false,0xffffff);
bitmap = new Bitmap(bmd);
addChild(bitmap)
bmd2 = new BitmapData(465,8,false,0xffffff);
bitmap2 = new Bitmap(bmd2);
addEventListener( Event.ENTER_FRAME, enterFrameHandler );
}
private var point:Point = new Point();
private function enterFrameHandler( event : Event ) : void {
bmd.scroll(0,-6);
point.y -= 6;
bmd2.perlinNoise(200, 200, 6, 0, false, false,
BitmapDataChannel.RED | BitmapDataChannel.GREEN | BitmapDataChannel.BLUE
, false, [point]);
var matrix:Matrix = new Matrix();
matrix.ty = 465-6;
bmd2.applyFilter(bmd2, bmd2.rect, new Point(), new ColorMatrixFilter([
.5, .5, .5, 0, 0, // red
0, .5, .5, 0, 0, // green
0, 10, .5, 0, 0, // blue
0, 0, 0, 1, 0] // alpha
)
);
bmd.draw(bitmap2, matrix);
bmd.applyFilter(bmd, bmd.rect, new Point(), new BlurFilter(2,5));
bmd.colorTransform(bmd.rect, new ColorTransform( 1, 0.95, 0.95, 1, -1, -1, -1, 0));
}
}
}