ROSACE
Javascript port @ http://jsdo.it/spanvega/n3Wo
/**
* Copyright spanvega ( http://wonderfl.net/user/spanvega )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6ooi
*/
package
{
import flash.geom.*;
import flash.display.*;
import flash.events.Event;
import flash.utils.getTimer;
/** @author SPANVEGA // CHRISTIAN **/
// Javascript port @ http://jsdo.it/spanvega/n3Wo
[ SWF (width = '465', height = '465', backgroundColor = '0x000000', frameRate = '50')]
public class ROSACE extends Sprite
{
public function ROSACE ()
{
var w : uint = 465, h : uint = 465;
var r : Rectangle = new Rectangle (0, 0, w, h);
var b : BitmapData = new BitmapData (w, h, true, 0);
var v : Vector.<uint> = new Vector.<uint>(w * h, true);
var lut_c : Vector.<int> = new Vector.<int>(w * h, true);
var lut_s : Vector.<int> = new Vector.<int>(w * h, true);
var lut_d : Vector.<int> = new Vector.<int>(w * h, true);
var x : Number, y : Number, d : Number, a : Number, z : int, n : int;
Wonderfl.disable_capture ();
stage.scaleMode = 'noScale';
graphics.beginFill (0, 1);
graphics.drawRect (0, 0, w, h);
addChild (new Bitmap (b));
n = v.length;
while (--n > -1)
{
x = -1 + 2 * (n % w) / w;
y = -1 + 2 * (n / w) / h;
d = Math.sqrt (x * x + y * y);
lut_c [n] = h * Math.cos (a = Math.atan2 (x, y)) / d;
lut_s [n] = w * Math.sin (a) / d;
a = d * ((w >> 2) + (h >> 2));if (a > 0xFF) a = 0xFF;
lut_d [n] = a;
}
addEventListener ('enterFrame', function () : void
{
x = Math.sin (d = getTimer () * 0.00075) * 750;
y = Math.cos (d) * 750;
n = v.length;
while (--n > -1)
{
z = (lut_c [n] - x ^ lut_s [n] + y) & w;
v [n] = lut_d [n] << 24 | z << 16 | 0 << 8 | z;
}
b.setVector (r, v);
});
}
}
}