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: forked from: inspired by Jim Lambie (090306)

バリエーション。scaleをトゥイーン。
円の描画方法を変更(もっと良い方法がありそう)。ENTER_FRAMEからTimerに。動きをゆっくり。
Get Adobe Flash player
by OneInchPunch 19 Mar 2009
    Embed
// forked from OneInchPunch's forked from: inspired by Jim Lambie (090306)
// バリエーション。scaleをトゥイーン。
// forked from OneInchPunch's inspired by Jim Lambie (090306)
// 円の描画方法を変更(もっと良い方法がありそう)。ENTER_FRAMEからTimerに。動きをゆっくり。
package {
    import flash.display.*;
    import flash.events.*;
    import flash.utils.*;
    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() {
                    var loopTimer:Timer = new Timer(250);
                    loopTimer.addEventListener(TimerEvent.TIMER, xLoop);
                    loopTimer.start();
                }
		
		
		// ================================================== 円を描画
		private function xLoop(e:TimerEvent):void {
			
			// 外側の円
			var outerCircle:Sprite = new Sprite();
			outerCircle.graphics.beginFill(0x000000);
			outerCircle.graphics.drawCircle(0, 0, stageX/2);
			outerCircle.graphics.endFill();

                        outerCircle.scaleX = 0;
                        outerCircle.scaleY = 0;

			addChild(outerCircle);
			
			
			// 内側の円
			// 乱数
			// 円の数 5 - 15
			var innerCircleNum:int = (Math.random()*10) + 5;
			// 内側の円の最大値
			var innerCircleMaxSize:int = 140;
			// 内側の円のサイズ
			var innerCircleSize:int = 140;
			
			for (var i:int=innerCircleMaxSize; i>0; i-=(innerCircleSize/innerCircleNum)) {
				
				innerCircleSize = i;
				
				// 最小サイズは10px
				if(innerCircleSize > 10) {
					// 内側の円を描画
					var innerCircle:Sprite = new Sprite();
					
					// 偶数・奇数をフラグにして白と黒を交互に
					if ((i % 2) == 0) {
						innerCircle.graphics.beginFill(0x000000);
					} else {
						innerCircle.graphics.beginFill(0xffffff);
					}
					
					innerCircle.graphics.drawCircle(stageX/2, stageY/2, i);
					innerCircle.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),
                            scaleX:2.0, scaleY:2.0,
                            time:10,
                            transition:"linear",
                            onComplete:xEnd,
                            onCompleteParams:[outerCircle]
							});
			
			// Tween終了時にMCを消す
			function xEnd(targetDot:Sprite):void {
				removeChild(targetDot);
                                targetDot = null;
			}
		}
	}
}