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: BetweenAS3で(11種類 / 模索中) - forked from: 画像を切り取って並べただけ

Get Adobe Flash player
by dali 30 Jan 2010
// forked from rsakane's BetweenAS3で(11種類 / 模索中) - forked from: 画像を切り取って並べただけ
package
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.Loader;
	import flash.events.Event;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.geom.Matrix;
	import flash.net.URLRequest;
	import flash.system.Security;
	import flash.system.LoaderContext;
	import org.libspark.betweenas3.BetweenAS3;
	import org.libspark.betweenas3.tweens.ITween;
	import org.libspark.betweenas3.easing.*;
	
	[SWF(width="465", height="465", frameRate="30", backgroundColor="0x000000")]
	public class Main extends Sprite
	{
		private const SIZE:int = 30;
		
		public function Main()
		{
			Wonderfl.capture_delay(10);
			Security.loadPolicyFile("http://farm4.static.flickr.com/crossdomain.xml");
			var loader:Loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.INIT, init);
			loader.load(new URLRequest("http://farm4.static.flickr.com/3291/3081450051_7492a14fc3.jpg"), new LoaderContext(true));
		}
		
		private function init(event:Event):void
		{
			var loader:Loader = event.currentTarget.loader;
			var bd:BitmapData = new BitmapData(loader.width, loader.height, false);
			bd.draw(loader);
			
			for (var y:int = 0; y < bd.height; y += SIZE)
			{
				var delay:Number = y / SIZE / 10;
				for (var x:int = 0; x < bd.width; x += SIZE)
				{
					var yy:int = (bd.height - 1 - y >= SIZE) ? SIZE : bd.height - 1 - y;
					var xx:int = (bd.width  - 1 - x >= SIZE) ? SIZE : bd.width  - 1 - x;
					
					if (xx <= 0 || yy <= 0) continue;
					
					var bitmap:Bitmap = new Bitmap(clipping(bd, x, y, xx, yy, 1.0));
					
					bitmap.x = x;
					bitmap.y = y;
					
					addChild(bitmap);
					
					var tx:int = (Math.random() >= 0.5) ? 0 : 465;
					var ty:int = (Math.random() >= 0.5) ? 0 : 465;
					var t:ITween = BetweenAS3.tween(bitmap, { scaleX:0.01, scaleY:0.01 }, null, 0);
					var t1:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0}, { scaleX:0.01, scaleY:0.01 }, 1.5, null);
					var t2:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, rotation:360 }, { scaleX:0.01, scaleY:0.01, rotation:270}, 1.0, null);
					var t3:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, alpha:1.0 }, { scaleX:0.01, scaleY:0.01, alpha:0.0 }, 1.0, null);
					var t4:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, alpha:1.0 }, { x:tx, y:ty, scaleX:0.01, scaleY:0.01, alpha:0.0 }, 1.0, null);
					var t5:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, alpha:1.0 }, { scaleX:0.01, scaleY:0.01, alpha:0.0}, 1.0, Back.easeInOut);
					var t6:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, alpha:1.0 }, { x:stage.stageWidth / 2, y:stage.stageHeight / 2, scaleX:0.01, scaleY:0.01, alpha:0.0 }, 1.0);
					var t7:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, alpha:1.0 }, { x:0, y:0, scaleX:0.01, scaleY:0.01, alpha:0.0 }, 1.0);
					var t8:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, alpha:1.0 }, { x:stage.stageWidth / 2, y:stage.stageHeight / 2, scaleX:2.0, scaleY:2.0, alpha:0.0 }, 1.0);
					var t9:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, alpha:1.0 }, { x:stage.stageWidth / 2, y:stage.stageHeight / 2, scaleX:1.0, scaleY:7.0, alpha:0.0 }, 1.0);
					var t10:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, alpha:1.0 }, { x:stage.stageWidth / 2, y:stage.stageHeight / 2, scaleX:1.0, scaleY:1.0, alpha:0.0 }, 1.0, Bounce.easeInOut);
					var t11:ITween = BetweenAS3.tween(bitmap, { x:x, y:y, scaleX:1.0, scaleY:1.0, alpha:1.0 }, { x:y, y:x, scaleX:0.0, scaleY:0.0}, 1.0);

					t1 = BetweenAS3.delay(t1, delay);
					
					BetweenAS3.serial
					(
						BetweenAS3.delay(t1, delay, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t2, 0, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t3, 0, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t4, 0, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t5, 0, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t6, 0, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t7, 0, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t8, 0, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t9, 0, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t10, 0, 4),
						BetweenAS3.delay(t, 0, 4),
						BetweenAS3.delay(t11, 0, 4)
					).play();
					
					delay += 0.1;
				}
			}
		}
		
		private function clipping(bd:BitmapData, x1:int, y1:int, width:int, height:int, scale:Number):BitmapData
		{
			var matrix:Matrix = new Matrix();
			matrix.translate(-x1, -y1);
			matrix.scale(scale, scale);
			var destbd:BitmapData = new BitmapData(width * scale, height * scale, false);
			destbd.draw(bd, matrix);
			
			return destbd;
		}
	}
}