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

forked from: fladdict challenge for amateurs

forked from checkmate's fladdict challenge for amateurs
* http://wonderfl.net/code/9aa63131757c6afa90dd0cfc8a73bbdb9f2f245a
*
* @author hanjuqu
/**
 * Copyright hanjuqu ( http://wonderfl.net/user/hanjuqu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/slgx
 */

/**
 * forked from checkmate's fladdict challenge for amateurs
 * http://wonderfl.net/code/9aa63131757c6afa90dd0cfc8a73bbdb9f2f245a
 *
 * @author hanjuqu
 */
package
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.BlendMode;
	import flash.display.Sprite;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.geom.ColorTransform;
	import flash.geom.Matrix;
	import flash.utils.getTimer;

	[SWF(width="465", height="465", backgroundColor="0x000000")]

	public class Beginner extends Sprite
	{
		private var bm:Bitmap;
		private var bmd1:BitmapData;
		private var bmd2:BitmapData;

		public function Beginner()
		{
			bmd1 = new BitmapData(480, 480, false, 0x000000);
			bm = new Bitmap(bmd1);

			addChild(bm);

			addEventListener(Event.ENTER_FRAME, update);

			stage.scaleMode = StageScaleMode.NO_SCALE;
		}

		private function update(e:Event): void
		{
			if (bmd2)
				bmd2.dispose();
			bmd2 = bmd1.clone();

			bmd2.setPixel(Math.random() * bmd1.width, Math.random() * bmd1.height, 0xFFFFFF);

			var matrix:Matrix = new Matrix();

			matrix.translate(-bmd1.width / 2, -bmd1.height / 2);
			matrix.rotate(Math.random() + .75);

			var scale:Number = Math.cos(Math.pow(getTimer(), 2) * Math.PI * 2 * .1);

			matrix.scale(scale, scale);
			matrix.translate(bmd1.width / 2, bmd1.height / 2);

			bmd1.draw(bmd2, matrix, null, BlendMode.SCREEN);

			bmd1.colorTransform(bmd2.rect, new ColorTransform(Math.random() * .4 + .6, Math.random() * .4 + .6, Math.random() * .4 + .6, 1, 0, 0, 0, 0));
		}
	}
}