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

flash on 2011-1-22

Get Adobe Flash player
by hig_an 22 Jan 2011
    Embed
/**
 * Copyright hig_an ( http://wonderfl.net/user/hig_an )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/lCKn
 */

package {
	import flash.display.Sprite;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.events.Event;
	import flash.geom.Matrix;
    [SWF(backgroundColor='#000000', frameRate='30', width='465', height='465')]

	
	public class Main extends Sprite {
		private var numOfList:Number = 100;
		private var circleSize:Number = 10;
		
		private var sp:Sprite;
		private var mt:Matrix;
		private var bmpd:BitmapData;
		private var list:Array;
		
		public function Main() {
			sp = newFig(0, 0, circleSize);
			list = new Array();
			bmpd = new BitmapData(stage.stageWidth, stage.stageHeight, false,0x0);
			mt = new Matrix();
			
			addChild(new Bitmap(bmpd));
			addEventListener(Event.ENTER_FRAME, loop);
			for (var i:int = 0; i < numOfList; i++) {
				list[i] = new Circle(i * 100+circleSize, 100);
			}
		}
		public function loop(e:Event):void {
			bmpd.lock();
			bmpd.fillRect(bmpd.rect, 0xffffff);
			list[0].x = Math.abs(mouseX - stage.stageWidth);
			list[0].y = Math.abs(mouseY - stage.stageHeight);
			mt.identity()
			mt.translate(list[0].x, list[0].y);
			bmpd.draw(sp, mt);
			for (var i:int = 1; i < list.length; i++) {
				list[i].x += (list[i - 1].x -list[i].x) * 0.5;
				list[i].y += (list[i - 1].y -list[i].y) * 0.5;
				mt.identity()
				mt.translate(list[i].x, list[i].y);
				bmpd.draw(sp, mt);
			}
			bmpd.unlock();
		}
		public function newFig(x:Number,y:Number,size:Number) :Sprite{
			var s:Sprite = new Sprite()
			s.graphics.beginFill(0xFF0000);
			s.graphics.drawCircle(x, y, size);
			s.graphics.endFill();
			
			return s;
		}
	}
}

class Circle{
		public var x:Number;
		public var y:Number;
		public var vx:Number = 0.2;
		public var vy:Number = 0.2;
		public function Circle(xx:Number, yy:Number ) {
			x = xx;
			y = yy;
		}
	}