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: ParticleEffect by BetweenAS3

外部画像を1pxごとに表示
// forked from Knuckle's forked from: ParticleEffect by BetweenAS3
// forked from twistcube's ParticleEffect
////////////////////////////////////////////////////////////////////////////////
//
//  外部画像を1pxごとに表示
//
////////////////////////////////////////////////////////////////////////////////
package
{
	import flash.display.* ;
	import flash.events.* ;
	import flash.system.* ;
	import flash.text.*;
	
	import org.libspark.betweenas3.BetweenAS3;
    import org.libspark.betweenas3.tweens.ITween;
    import org.libspark.betweenas3.easing.*;
	
	[SWF(width="500", height="500", backgroundColor="0xFFFFFF", frameRate="30")]
	public class ParticleEffect extends Sprite
	{

		private var _original:Sprite
		private var _particleList:ParticleList;
		private var _startTime:int;
		//
		private const SCALE:Number = 2;
		
		public function ParticleEffect( ) {
			init( );
		}
		//
		private function init( ):void {
			stage.scaleMode=StageScaleMode.NO_SCALE;
			stage.align=StageAlign.TOP_LEFT;
			stage.quality=StageQuality.LOW;

			Security.loadPolicyFile( "http://www.twist-cube.com/wonderfl/crossdomain.xml" );
			
			
			var textF:TextField = new TextField();
			textF.autoSize = TextFieldAutoSize.LEFT;
			var textFormat:TextFormat = new TextFormat();
			textFormat.font = "Arial";
			textFormat.color = 0x000000;
			textFormat.size = 750;
			textFormat.bold = true;
			textF.defaultTextFormat = textFormat;
			textF.text = "SSN-aki"
			_original = new Sprite();
			_original.addChild(textF);
			setData();
		}
		
		private function setData():void {
			var nStartX:Number = Math.floor( ( stage.stageWidth - _original.width ) / 2 );
			var nStartY:Number = Math.floor( ( stage.stageHeight - _original.height ) / 2 );
			var centerX:Number = nStartX + (_original.width/2)
			var centerY:Number = nStartY + (_original.height/2)

			_particleList=new ParticleList(_original);

			//_canvas=new BitmapData(stage.stageWidth,stage.stageHeight,true,0xFFFFFFFF);
			//addChild( new Bitmap( _canvas ) );
			
			var current:Particle;
			var tweens:Array = []; 
			var t:ITween;
			var nLength:uint=_particleList.list.length;
			for (var i:uint = 0; i < nLength; i++) {
				current=_particleList.list[i];
				current.x= centerX -((centerX - (nStartX+current.tx) )* SCALE);
				current.y = centerY -((centerY - (nStartY + current.ty) ) * SCALE);
				t = BetweenAS3.tween(current, { x:(nStartX + current.tx), y:(nStartY + current.ty)}, null, 2, Sine.easeIn);
				var wait:Number = (Math.abs(centerX - current.x));
				wait += (Math.abs(centerY - current.y));
				t = BetweenAS3.delay(t, (wait/100)+1)
				tweens.push(t);
				
				addChild(current);
			}
			
            t = BetweenAS3.parallel.apply(null, tweens);
            t = BetweenAS3.serial(
                t,
                BetweenAS3.reverse(t),
				BetweenAS3.scale(t, 0.2),
				BetweenAS3.reverse(BetweenAS3.scale(t, 0.2))
            );
            t.stopOnComplete = false;
            t.play();


		}
	}
}


import flash.display.*;
	import flash.geom.ColorTransform;
	import flash.geom.Matrix;
	import flash.geom.Rectangle;

	class ParticleList {
		private var _originImage:DisplayObject;
		private var _list:Array = new Array( );

		public function ParticleList( _originImage:DisplayObject ) {
			this._originImage=_originImage;
			init( );
		}

		private function init( ):void {
			var nW:Number=_originImage.width;
			var nH:Number=_originImage.height;
			var originBitmapData:BitmapData=new BitmapData(_originImage.width,_originImage.height,true,0xFFFFFFFF);
			originBitmapData.draw( _originImage );

			var originBitmap:Bitmap=new Bitmap(originBitmapData);

			for (var i:uint = 0; i < nW; i++) {
				for (var j:int = 0; j < nH; j++) {
					var color:uint=originBitmapData.getPixel32(i,j);
					if (color == 0xFFFFFFFF) {
						continue;
					}
					_list.push( new Particle( i, j, color ) );
				}
			}
		}

		public function get list( ):Array {
			return _list;
		}

		public function set list( _list:Array ):void {
			this._list=_list;
		}
	}
	import flash.display.*;
	class Particle extends Bitmap {
		public var tx:Number=0;
		public var ty:Number=0;
		public var color:int=0;

		public function Particle( x:Number, y:Number, color:int ) {
			this.tx=x;
			this.ty=y;
			this.x=x;
			this.y=y;
			this.color = color
			
			var bitmapData:BitmapData = new BitmapData(1, 1, true, this.color);
			super(bitmapData);
		}
	}