Blue Sky and Cloud
/**
* Copyright heart_thai ( http://wonderfl.net/user/heart_thai )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2mlf
*/
package {
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData
import flash.events.Event;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.display.BlendMode;
import flash.display.GradientType;
public class Main extends Sprite {
private var canvas:Bitmap;
private var bmp:BitmapData;
private var i:Number = 0;
private var obj:Sprite;
private var sky:Sprite;
public function Main() {
// write as3 code here.
sky = new Sprite();
var mat:Matrix = new Matrix();
mat.createGradientBox(stage.stageWidth, stage.stageHeight,-90, 0, 0)
sky.graphics.beginGradientFill(GradientType.LINEAR , [0x0099cc, 0xCCF2FF] , [1, 1], [0, 255], mat );
sky.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
addChild(sky);
obj = new Sprite();
obj.blendMode = BlendMode.OVERLAY
addChild(obj);
bmp = new BitmapData(stage.stageWidth, stage.stageHeight );
canvas = new Bitmap(bmp);
obj.addChild(canvas);
this.addEventListener(Event.ENTER_FRAME , loop );
}
private function loop(e:Event):void {
bmp.perlinNoise(100, 100, 1 , 50 , false, true, 7, true, [new Point(i, 0), new Point()] );
i += 2;
//bmp.threshold(bmp, bmp.rect, new Point(), ">", 0x777777, 0xFFFFFF , 0xFFFFFF );
//bmp.threshold(bmp, bmp.rect, new Point(), "<", 50 , 0x000000 , 0x000000);
//bmp.threshold(bmp, bmp.rect, new Point(), "<",50 , 0x000000 , 0x000000 );
}
}
}