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

fffforked from: Binary Squares

clickable Binary Squares
And now for something completely different...
Get Adobe Flash player
by yonatan 09 Oct 2011
/**
 * Copyright yonatan ( http://wonderfl.net/user/yonatan )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/wIng
 */

// forked from makc3d's ffforked from: Binary Squares
// forked from makc3d's forked from: forked from: Binary Squares
// forked from makc3d's forked from: Binary Squares
// forked from Aquioux's Binary Squares
package {
    import flash.display.Sprite;
    [SWF(width = "465", height = "465", frameRate = "30", backgroundColor = "#FFFFFF")]
    /**
    * Binary Squares
    * And now for something completely different...
    */
    public class Main extends Sprite {
        public function Main():void {
            addEventListener ("enterFrame", loop);
            stage.addEventListener ("click", function(e:*):void { foo--; if(!foo) foo=4; });
        }
        private var a:Number = 0;
        private var foo:int = 4;
        private function loop (e:*):void {
            var sw:int = stage.stageWidth;
            var sh:int = stage.stageHeight;
			var w2:Number = sw / 2;
			graphics.clear();
            graphics.beginFill (0);
			rec (w2, w2, w2, Math.abs(Math.sin(stage.mouseX/sw*Math.PI))/2, a);
            a += (stage.mouseY-sw/2)*0.0001;
		}

		public function rec (atx:Number, aty:Number, s:Number, ss:Number, a:Number = 0):void {
			if (s > 2) {
                var hs:Number = s/2;
				graphics.drawRect (atx - hs, aty - hs, s, s);
                s*=ss;
                for(var i:int=0; i<foo; i++) {
                    var m:Number = a+i*Math.PI*2/foo;
				    rec(atx+s*Math.sin(m*5), aty+s*Math.cos(m*7), s, ss, -a);
                }
			}
		}
    }
}