forked from: Legalize It
// forked from makc3d's Legalize It
package {
import flash.display.Loader;
import flash.display.Sprite;
import flash.net.URLRequest;
[SWF(backgroundColor=0)]
public class LegalizeIt extends Sprite {
public var N:int = 42;
public var stuff:Vector.<It>;
public function LegalizeIt () {
stuff = new Vector.<It> (N);
for (var i:int = 0; i < N; i++) {
stuff [i] = new It;
stuff [i].x = 600 * Math.random () - 100;
stuff [i].y = (i * 465.0) / N;
stuff [i].rotation = 360 * Math.random ();
addChild (stuff [i]);
}
addEventListener ("enterFrame", function ():void {
for (var i:int = 0; i < N; i++) {
stuff [i].x += 2.0 + i / 20.0;
if (stuff [i].x > 500) stuff [i].x -= 600;
stuff [i].rotation += 1;
}
});
stage.quality = "low";
var music:Loader = new Loader;
music.load (new URLRequest ("http://www.youtube.com/v/VgXmQI0wxpQ&autoplay=1"));
}
}
}
import flash.display.Shape;
class It extends Shape {
public function It () {
var R:Number = 10 + 60 * Math.random ();
graphics.lineStyle (1, 0xFF00, 0.4 + 64 * Math.random ());
// http://twitter.com/sakri/status/8188823262
for (var t:Number = 0; t < Math.PI; t += 0.001) {
var r:Number = R * Math.sin (5 * t) * Math.cos (4 * t);
r *= 1 - (0.5 - 0.45 * Math.abs (r / R)) * Math.sin (123 * t);
graphics.lineTo (r * Math.cos (t), -r * Math.sin (t));
}
}
}