In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: 水平線 forked from: Clouds

// forked from nemu90kWw's 水平線 forked from: Clouds
// forked from h_sakurai's Clouds
package
{
	import flash.display.*;
	import flash.geom.*;

	public class Ocean extends Sprite
	{
		private var W:int = 384, H:int = 64;
		public function Ocean()
		{
			var offset:Array = [new Point(), new Point()];
			var org:BitmapData = new BitmapData(W/2, H, false);
			var buf:BitmapData = new BitmapData(W/2, H, false, 0xFF008080);
			var out:BitmapData = new BitmapData(W, H, false);
			var bm:Bitmap = new Bitmap(out);
			var grd1:Sprite = new Sprite(), grd2:Sprite = new Sprite();
			var matrix:Matrix = new Matrix();
			
			bm.rotationX = -70;
			bm.scaleX = 1.2, bm.scaleY = 5.8;
			bm.y = 160;
			addChild(bm);
			
			matrix.createGradientBox(465, 160, Math.PI/2);
			grd1.graphics.beginGradientFill("linear", [0x103860, 0x4070B8, 0x60B0E0, 0xD0F0F0], [100, 100, 100, 100], [0, 0x80, 0xD0, 0xFF], matrix);
			grd1.graphics.drawRect(0, 0, 465, 160);
			grd1.graphics.endFill();
			
			matrix.createGradientBox(465, 192, Math.PI/2);
			grd2.y = 160;
			grd2.graphics.beginGradientFill("linear", [0xE0F0F0, 0xA0C0D8, 0x6090B0], [100, 80, 0], [0, 0x50, 0xFF], matrix);
			grd2.graphics.drawRect(0, 0, 465, 192);
			grd2.graphics.endFill();
			grd2.blendMode = "hardlight";
			
			addChild(grd1);
			addChild(grd2);

			addEventListener("enterFrame", function():void
			{
				offset[0].x+=0.42;
				offset[0].y+=0.05;
				offset[1].x+=0.15;
				offset[1].y+=0.075;
				
				org.perlinNoise(14, 5, 2, 0, false, false, 0, true, offset);
				org.colorTransform(org.rect, new ColorTransform(1.2, 1.2, 1.2, 1, -40, -40, -40, 0));
				buf.draw(org, new Matrix(1, 0, 0, 1, 0, 0), new ColorTransform(-1, -1, 0, 1, 176, 192, 192, 0), "hardlight");
				buf.draw(org, new Matrix(1, 0, 0, 0.927, 0, 4), new ColorTransform(0.5, 0.5, 0.5, 1, 192, 184, 255, 0), "multiply");
				out.draw(buf, new Matrix(2, 0, 0, 1, 0, 0), new ColorTransform(1.75, 2, 1, 1, -255, -255, 0, 0));
				out.colorTransform(out.rect, new ColorTransform(0.4, 0.3, 0, 1, 16, 32, 80, 0));
			});
		}
	}
}