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

夢のキャスト Ver.1.1

ちいせえwww
おまけにコード汚い
今後改良予定
Get Adobe Flash player
by aaharu 06 Jun 2010
/**
 * Copyright aaharu ( http://wonderfl.net/user/aaharu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/si8O
 */

// ちいせえwww
// おまけにコード汚い
// 今後改良予定
package {
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.text.TextField;
	
	import org.libspark.betweenas3.BetweenAS3;
	import org.libspark.betweenas3.easing.Quad;
	import org.libspark.betweenas3.tweens.ITween;
	
	public class dc_startup extends Sprite {
		private const STR:String = "Creamcast";
		private const R:uint = 18;
		private var array:Array = [];
		private var ball:Ball;
		private var sp:Sprite;
		private const W:int = stage.stageWidth / 2;
		private const H:int = stage.stageHeight / 2;
		
		public function dc_startup() {
			stage.scaleMode = StageScaleMode.SHOW_ALL;
			stage.align = StageAlign.TOP_LEFT;
			stage.frameRate = 30;
			
			var temp:TextField = new TextField();
			temp.text = STR;
			
			for(var i:uint = 0; i < STR.length; i++) {
				var tf:TextField = new TextField();
				tf.text = STR.charAt(i);
				if(i) tf.x = array[i-1].x + array[i-1].textWidth;
				else tf.x = W - temp.textWidth / 2;
				tf.y = H;
				array.push(tf);
			}
			
			ball = new Ball(true);
			ball.x = array[0].x - 20;
			ball.y = 0;
			addChild(ball);
			
			var tween:ITween = BetweenAS3.bezier(ball, {x: array[0].x + array[0].textWidth, y: H + 10}, {x: W - 50, y: H - 60}, {x: W - 20, y: H - 30}, 2, Quad.easeIn);
			tween.onComplete = function():void { bounce(1) };
			tween.play();
		}
		
		private function bounce(n:uint):void {
			character(n-1);
			
			var tween:ITween = BetweenAS3.bezierTo(ball, {x: array[n].x + array[n].textWidth, y: H + 10}, {x: array[n].x + array[n].textWidth / 4, y: H - 20}, 0.35);
			if(n < STR.length - 1) tween.onComplete = function():void { bounce(n+1) };
			else tween.onComplete = ぴょーん();
			tween.play();
		}
		
		private function character(index:uint):void {
			addChild(array[index]);
			BetweenAS3.tween(array[index], {y: array[index].y, alpha: 1}, {y: array[index].y + 7, alpha: 0}).play();
		}
		
		private function ぴょーん():Function {
			return function ():void {
				character(STR.length - 1);
				
				var tween:ITween = BetweenAS3.bezierTo(ball, {x: W, y: H - 15}, {x: (W + ball.x) / 2, y: H - 43}, 1, Quad.easeOut);
				tween.play();
				tween.onComplete = function ぐるぐる():void {
					sp = new Sprite();
					addChild(sp);
					sp.graphics.lineStyle(3, ball.color);
					sp.graphics.moveTo(ball.x, ball.y);
					var tweenArray:Array = [];
					addEventListener(Event.ENTER_FRAME, onEnterFrame);
					for(var i:uint = 0; i < 900; i++) {
						var toX:Number = ball.x - R * i / 720 * Math.cos(i * Math.PI / 180);
						var toY:Number = ball.y - R * i / 720 * Math.sin(i * Math.PI / 180);
						tweenArray.push(BetweenAS3.to(ball, {x: toX, y: toY}, 0.003));
					}
					var t:ITween = BetweenAS3.serialTweens(tweenArray);
					t.onComplete = function():void {
						removeEventListener(Event.ENTER_FRAME, onEnterFrame);
						sp.graphics.lineTo(ball.x, ball.y);
					};
					t.play();
				};
			}
		}
		
		private function onEnterFrame(e:Event):void {
			sp.graphics.lineTo(ball.x, ball.y);
		}
	}
}

import flash.display.Sprite;

class Ball extends Sprite {
	private var _color:Number;
	
	public function get color():uint {
		return _color;
	}
	
	public function Ball(j:Boolean) {
		if(j) {
			graphics.beginFill(0xFF0000);
			_color = 0xFF0000;
		}
		else {
			graphics.beginFill(0x0000FF);
			_color = 0x0000FF;
		}
		graphics.drawCircle(0, 0, 2);
		graphics.endFill();
	}
}