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

ffforked from: Binary Squares

/**
 * Copyright makc3d ( http://wonderfl.net/user/makc3d )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/wImp
 */

// 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 = "512", height = "512", frameRate = "30", backgroundColor = "#FFFFFF")]
    /**
     * Binary Squares
     * And now for something completely different...
     */
    public class Main extends Sprite {
        public function Main():void {
            addEventListener ("enterFrame", loop);
        }
        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, 0.45 * mouseX / 465);
		}
		public function rec (atx:Number, aty:Number, w:Number, k:Number):void {
			if (w > 1) {
				var w2:Number = w / 2, m:Number = 0.5 - 2 * k
				graphics.drawRect (atx - w2, aty - w2, w, w);
				rec (atx - w2, aty - m * w2, w*k, k);
				rec (atx - m * w2, aty + w2, w*k, k);
				rec (atx + w2, aty + m * w2, w*k, k);
				rec (atx + m * w2, aty - w2, w*k, k);
			}
		}
    }
}