Hidden Sierpiński

var canvas:BitmapData=new BitmapData(255,255,false,0x000000);
addChild(new Bitmap(canvas, "auto", true));

scaleX = scaleY = 1.5;

addEventListener(Event.ENTER_FRAME, onLoop);
function onLoop(evt:Event):void {
	for (var i:int  = 0; i<canvas.width * canvas.height; i++) {
		var ox:int= i % canvas.width;
		var oy:int= i / canvas.width;
		var col =  (ox | oy) * mouseX % 255;
		canvas.setPixel(ox, oy, col << 16 | col << 8 | col);
	}
}

Sometimes when I’m writing a program that does some pixel pushing I’ll save the file and then start arbitrarily adding bitwise operations to it…. just to see what happens. Sierpinski-esque stuff occurs often. This will work in your timeline – move your mouse left and right to generate images like these:





Leave a Reply

Your email address will not be published. Required fields are marked *