DRAFT
/**
* Copyright christian ( http://wonderfl.net/user/christian )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/k311
*/
package
{
import flash.geom.*;
import flash.filters.*;
import flash.display.*;
/* @author SPANVEGA // CHRISTIAN */
[ SWF (width = '465', height = '465', backgroundColor = '0xFFFFFF', frameRate = '30')]
public class DRAFT extends Sprite
{
private var scale : Number = 4,
w : uint = 465, h : uint = 465, p : Point = new Point (0, 0),
r : Rectangle = new Rectangle (0, 0, w, h);
private var a : BitmapData = new BitmapData (w / scale, h / scale, true, 0),
b : BitmapData = new BitmapData (w, h, true, 0);
private var g : GlowFilter = new GlowFilter (0x808080, 1, 3, 3, 3, 5),
m : Matrix = new Matrix (scale, 0, 0, scale, 0, 0),
o : Array = [new Point (), new Point ()],
n : uint = Math.random () * 0xFFFF;
private var f : FAST_NOISE;
public function DRAFT ()
{
Wonderfl.disable_capture ();
stage.scaleMode = 'noScale';
addChild (new Bitmap (b));
f = new FAST_NOISE (w, h, 5); f.low = 0xBE;
addEventListener ('enterFrame', function () : void
{
o[0].offset (1, -1); o[1].offset (-1, 1);
f.render ();
a.perlinNoise (50, 50, 2, n, true, false, 8, true, o);
b.draw (f, null);
b.draw (a, m, null, BlendMode.MULTIPLY);
b.threshold (b, r, p, '<=', 0xFFBEBEBE, 0x00000000);
b.applyFilter (b, r, p, g);
});
}
}
}
//
import flash.display.*;
internal class FAST_NOISE extends BitmapData
{
private var n : BitmapData, s : Shape = new Shape ();
public function FAST_NOISE (w : uint, h : uint, scale : Number) : void
{
super (w, h, true, 0);
n = new BitmapData (w / scale, h / scale, true, 0);
}
public function render () : void
{
n.noise (Math.random () * 0xFFFF, low, high, channelOptions, grayScale);
s.graphics.clear ();
s.graphics.beginBitmapFill (n);
s.graphics.drawRect (0, 0, width, height);
fillRect (rect, 0);
draw (s);
}
public var channelOptions : uint = 15;
public var grayScale : Boolean = true;
public var low : uint = 0x00;
public var high : uint = 0xFF;
}