// add a BitmapData object to the stage in one line: addChild(new Bitmap(new BitmapData(200,200,false,0x00000))); // draw a radial gradient for (var i:int = 0; i<200; i++) for (var j:int = 0; j<200; j++) Bitmap(getChildAt(0)).bitmapData.setPixel( i, j, 100 + 100 * Math.sin(Math.sqrt(Math.pow(i - 100, 2)+Math.pow(j - 100, 2)) * 40 * Math.PI/180) << 16 ); /* WARNING: This code was written for fun. Use at your own risk. */
Next I’ll post a readable version, just wanted to see how compact I could get this…
This was inspired by all the pixel bender stuff that I’ve seen. I did the same thing with setVector() – will post about setVector() in the future.