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: 四畳半神話大系的な何か

/**
 * Copyright xor ( http://wonderfl.net/user/xor )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/r8A2
 */

// forked from gupon's forked from: 四畳半神話大系的な何か
// forked from Nyarineko's 四畳半神話大系的な何か
package
{
	import flash.display.*;
	import flash.events.*;
	
	import org.libspark.betweenas3.BetweenAS3;
	import org.libspark.betweenas3.easing.*;
	import org.libspark.betweenas3.tweens.ITween;
	import org.libspark.betweenas3.events.TweenEvent;

    [SWF(width = "465", height = "465", backgroundColor = "0x222222")]
	public class Main extends Sprite
	{
		private var EZ:Number = .9; //速度が変わるよ!
		private var _tw:ITween;
		private var _container:Sprite = new Sprite();
		
		
		private var MAX:int = 100;
		private var _cnt:int = 0;
		private var _topBox:Box;
		private var _lastBox:Box;
		
		public function Main():void
		{
			var w:Number = 200;
			var h:Number = 200;
			var box:Box = new Box(w,h);
			_topBox = box;
			_lastBox = box;
			
			_container.rotationZ = Math.random() * 360;
			_container.x = Math.random() * 360;
			_container.y = Math.random() * 360;
			_container.z = Math.random() * 360;	
			//_boxs = box;
			
			addChild(_container);
			_container.addChild(box);
			
			_tw = BetweenAS3.parallel(
				BetweenAS3.tween(box,{width:box.width},{width:0},EZ,Quint.easeInOut),
				BetweenAS3.tween(box,{height:box.height},{height:0},EZ,Quint.easeInOut));
			_tw.addEventListener(TweenEvent.COMPLETE,compTween);
			_tw.play();
		}
		
		private function compTween(e:TweenEvent):void
		{
			_tw.removeEventListener(TweenEvent.COMPLETE,compTween);
			_cnt++;
			
			EZ = .5;
			var twArray:Array = [];
			var w:Number = 100;
			var h:Number = 100;
			
			var box:Box = _topBox;
			//途中の部屋
			while(box.linkBox){
				if(_lastBox.width>_lastBox.height){
					twArray.push(BetweenAS3.parallel(
						BetweenAS3.tween(box,{x:box.x - _lastBox.width/2},null,EZ,Quint.easeInOut),
						BetweenAS3.tween(box,{y:box.y - _lastBox.height+2},null,EZ,Quint.easeInOut)
					));
				}else{
					twArray.push(BetweenAS3.parallel(
						BetweenAS3.tween(box,{x:box.x - _lastBox.width+2},null,EZ,Quint.easeInOut),
						BetweenAS3.tween(box,{y:box.y - _lastBox.height/2},null,EZ,Quint.easeInOut)
					));
				}
				box = box.linkBox;
			}
			
			//最後の部屋と新しい部屋
			var box_new:Box = new Box(w,h);
			_container.addChild(box_new);
			
			if(box.width>box.height){
				twArray.push(BetweenAS3.parallel(
					BetweenAS3.tween(box,{x:box.x - box.width/2},null,EZ,Quint.easeInOut),
					BetweenAS3.tween(box,{y:box.y - box.height+2},null,EZ,Quint.easeInOut),
					BetweenAS3.tween(box_new,{x:0},{x:box.width/2},EZ,Quint.easeInOut),
					BetweenAS3.tween(box_new,{y:0},{y:box.height},EZ,Quint.easeInOut)
				));
			}else{
				twArray.push(BetweenAS3.parallel(
					BetweenAS3.tween(box,{x:box.x - box.width+2},null,EZ,Quint.easeInOut),
					BetweenAS3.tween(box,{y:box.y - box.height/2},null,EZ,Quint.easeInOut),
					BetweenAS3.tween(box_new,{x:0},{x:box.width},EZ,Quint.easeInOut),
					BetweenAS3.tween(box_new,{y:0},{y:box.height/2},EZ,Quint.easeInOut)
				));
			}
			twArray.push(BetweenAS3.parallel(
				BetweenAS3.tween(box_new,{width:w},{width:0},EZ,Quint.easeInOut),
				BetweenAS3.tween(box_new,{height:h},{height:0},EZ,Quint.easeInOut)));
			
			//新しい配列をリストに追加
			box.linkBox = box_new;
			_lastBox = box_new;
			//10個以上になったら古いの消すよ
			if(_cnt > 12){
				var bufBox:Box = _topBox.linkBox;
				_container.removeChild(_topBox);
				_topBox = bufBox;
			}
			//ちょいちょい角度を変えてみる
			if(_cnt % 3 == 0){
				var s:Number = .85;
				twArray.push(
					BetweenAS3.tween(_container,{rotation:Math.random() * 180 - 90},null,EZ,Quint.easeInOut),
					BetweenAS3.tween( _container, { scaleX:s, scaleY:s }, null, EZ, Quint.easeInOut));
			}
			_tw = BetweenAS3.parallelTweens( twArray );
			_tw.addEventListener(TweenEvent.COMPLETE,compTween);
			
			_tw.play();
		}
	}
}

import flash.display.Sprite;

class Box extends Sprite
{
	private static var myCount:int = 0;
	public var linkBox:Box = null;
	public function Box(w:Number,h:Number):void
	{
		var lineColor:uint = 0x333333;
		var colors:Array = [0x6397AD,0xB73A37,0xF9E08F,0x513633,0x607567,0x8C915C,0x32353A,0xEFCC6A,0xBABCB3];
		//graphics.lineStyle( 8,lineColor,1, true, "none","none","miter");
		graphics.beginFill( colors[1],1);
		graphics.drawRect( -myCount, -myCount, w-myCount, h-myCount);
		//graphics.drawCircle(w,h,h);
		graphics.drawRoundRect((-w+myCount)>>1,(-h+myCount)>>1,w+myCount,h+myCount,myCount);
		graphics.drawCircle(-myCount>>1,-myCount>>1,myCount);
		graphics.endFill();
		this.blendMode = "invert";
		myCount++;
	}
}