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

inspired by Jim Lambie (090306)

Get Adobe Flash player
by OneInchPunch 06 Mar 2009
    Embed
package {
    import flash.display.*;
    import flash.events.*;
    import caurina.transitions.Tweener;
    
    [SWF(backgroundColor="#000000", frameRate=30)]
    
    public class CircleMotion extends Sprite {
		
		private var stageX:Number = stage.stageWidth;
		private var stageY:Number = stage.stageHeight;
		
		// ================================================== コンストラクタ
		public function CircleMotion() {
                    addEventListener(Event.ENTER_FRAME, xLoop);
                }
		
		
		// ================================================== 円を描画
		private function xLoop(e:Event):void {
			
			// 外側の円
			var outerCircle:Sprite = new Sprite();
			outerCircle.graphics.beginFill(0x000000);
			outerCircle.graphics.drawCircle(stageX/2, stageY/2, 150);
			outerCircle.graphics.endFill();

			addChild(outerCircle);
			
			
			// 内側の円
			// 乱数
			// 円の数 5 - 20
			var innerCircleNum:int = 5+Math.random()*20;
			// 内側の円の最大値
			var innerCircleMaxSize:int = 149;
			
			
			for (var i:int=5; i<=innerCircleNum; i++) {
				
				// 乱数
				// 内側の円の大きさ
				var innerCircleSize:int = Math.random()*innerCircleMaxSize;
				// 1つ前の円との差を取って
				var innerCircleMaxSizeDiff:Number = innerCircleMaxSize-innerCircleSize;
				// 1つ前の円より小さく描画、マイナスだったら何もしないで最後まで
				if(innerCircleMaxSizeDiff>0) {
					innerCircleMaxSize = innerCircleMaxSize - innerCircleMaxSizeDiff;
				} else {
					innerCircleMaxSize = 0;
				}
				
				// 内側の円を描画
				var innerCircle:Sprite = new Sprite();
				// 偶数・奇数をフラグにして白と黒を交互に
				if ((i % 2) == 0) {
					outerCircle.graphics.beginFill(0x000000);
				} else {
					outerCircle.graphics.beginFill(0xffffff);
				}
				outerCircle.graphics.drawCircle(stageX/2, stageY/2, innerCircleSize);
				outerCircle.graphics.endFill();
				
				outerCircle.addChild(innerCircle);
			}
			
			// Tweenerのパラメータ
			Tweener.addTween(outerCircle, {
                            x:Math.floor(Math.random()*stageX -stageX/2),
                            y:Math.floor(Math.random()*stageY -stageY/2),
                            time:1,
                            transition:"linear",
                            onComplete:xEnd,
                            onCompleteParams:[outerCircle]
							});
			
			// Tween終了時にMCを消す
			function xEnd(targetDot:Sprite):void {
				removeChild(targetDot);
			}
		}
	}
}