forked from: forked from: whatever
man, screw trigonometry
/**
* Copyright wh0 ( http://wonderfl.net/user/wh0 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/Frop
*/
// forked from wh0's forked from: whatever
// forked from wh0's whatever
package {
import flash.display.*;
import flash.events.*;
import flash.filters.*;
import flash.geom.*;
import mx.utils.Base64Decoder;
public class FlashTest extends Sprite {
private const seed:uint = Math.random() * 0x80000000;
private var p1:Point = new Point(0, 0);
private var p2:Point = new Point(32, 32);
private var bd:BitmapData;
public function FlashTest() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var d:Base64Decoder = new Base64Decoder();
d.decode('oQECAAAMX091dENvb3JkAKMABHNyYwChAgQBAA9kc3QAMAEA8QAAEAAdAgDBAQAAAAkCAIABAEAACQIAgAEAgAAKAgBAAQBAAAoCAEABAIAAAgIAQAIAAAACAQDiAgAAAAUBAOICAFQA');
var sf:ShaderFilter = new ShaderFilter(new Shader(d.toByteArray()));
bd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x000000);
addChild(new Bitmap(bd)).filters = [sf];
addEventListener(Event.ENTER_FRAME, frame);
}
private function frame(e:Event):void {
bd.perlinNoise(
128, 128, 2,
seed,
false, true,
BitmapDataChannel.RED | BitmapDataChannel.GREEN | BitmapDataChannel.BLUE,
false,
[p1, p2]
);
p1.x += Math.SQRT1_2;
p1.y += 1;
p2.x += Math.SQRT2;
p2.y += 1;
}
}
}
/*
parameter "_OutCoord", float2, f0.rg, in
texture "src", t0
parameter "dst", float4, f1, out
; f1 = sample()
texn f1, f0.rg, t0
; f2.r = min(f1.r, f1.g, f1.b)
; f2.g = max(f1.r, f1.g, f1.b)
mov f2.rg, f1.rr
min f2.r, f1.g
min f2.r, f1.b
max f2.g, f1.g
max f2.g, f1.b
; f1.rgb = (f1.rgb - f2.rrr) / (f2.ggg - f2.rrr)
sub f2.g, f2.r
sub f1.rgb, f2.rrr
div f1.rgb, f2.ggg
*/