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

crossing streams

残像エフェクト。   
@author siba
/**
 * Copyright onedayitwillmake ( http://wonderfl.net/user/onedayitwillmake )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bNGh
 */

// forked from nopants's forked from: 残像
// forked from siba2260's 残像
// forked from siba2260's code on 2008-12-18
// write as3 code here..
package {
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.PixelSnapping;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.geom.ColorTransform;
	import flash.geom.Matrix;
        import flash.filters.BitmapFilter
        import flash.filters.GlowFilter;
        import flash.filters.ColorMatrixFilter
        import flash.filters.BlurFilter
        import flash.display.BitmapData
        import flash.geom.Point;
        import caurina.transitions.Tweener
    
	[SWF(width=425, height=425, framerate="60", backgroundColor=0x0000)]

	/**
	 * 残像エフェクト。   
	 * @author siba
	 */
	public class Main17 extends Sprite {
		
		// ----------------------------
		//	メンバ変数
		// ----------------------------
		 
		private var afterBitmapData:BitmapData = new BitmapData(800, 600, false, 0x000000); 
		private var afterImage:Bitmap = new Bitmap(afterBitmapData, PixelSnapping.AUTO, true);
		private var character:Character = new Character();
		
		
		// ----------------------------
		//	初期化
		// ----------------------------
		 
		public function Main17() {
			addChild(afterImage);
			
			character.x = -1000
			character.y = -1000;
			addChild(character);
			
			addEventListener(Event.ENTER_FRAME, draw);
                        Tweener.addTween(character, {
                            x: stage.stageWidth * 0.5
                            , y: stage.stageHeight*0.5,
                             time: 2, transition: "easeOutBack",
                            onComplete: function startListening():void{addEventListener(Event.ENTER_FRAME, chase);}
                             })
                        
                }
		
		
		// ----------------------------
		//	イベント
		// ----------------------------
		private var filter1:BitmapFilter = new ColorMatrixFilter( [ 0.98, 0, -0.2, 0, 0,   0, 0.95, 0, 0, 0,   0, 0, 0.9, 0, 0,   0, 0, 0, 1, 0 ] );
private var filter2:BitmapFilter = new BlurFilter(2,2,1);
private var op:Point = new Point(0,0);
 
                   //
   
                private function chase(e:Event):void
                {
                      character.x = stage.mouseX;
                      character.y = stage.mouseY;    
                }
		private function draw(event:Event):void {
			

                      
                        afterBitmapData.colorTransform(afterBitmapData.rect, 
						 new ColorTransform(Math.random() * 0.3 + 0.8, Math.random() * 0.3 + 0.8, Math.random() * 0.36 + 0.8, 1.5, 0, 0, 0, 0));
   
                        var mat1:Matrix = new Matrix();
                        mat1.translate(character.x, character.y);
                                              
                        var mat2:Matrix = new Matrix();
                        mat2.translate(stage.stageWidth-character.x, stage.stageHeight-character.y);
                        

                        var mat3:Matrix = new Matrix();
                        mat3.translate(stage.stageWidth-character.x, character.y);
                        
                        var mat4:Matrix = new Matrix();
                        mat4.translate(character.x, stage.stageHeight-character.y);
                        
			afterBitmapData.draw(character, mat1);
                        afterBitmapData.draw(character, mat2);
                        afterBitmapData.draw(character, mat3);
                        afterBitmapData.draw(character, mat4);
//                        afterBitmapData.scroll(0, 0.4)
                        
		} 
		
	}
}


// ------------------------------------
//	内部クラス
// ------------------------------------

import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.GradientType;

class Character extends Sprite {
	
	// --------------------------------
	//	メンバ変数
	// --------------------------------
	
	private var isStage:Boolean = false;
	
	
	// --------------------------------
	//	初期化
	// --------------------------------
	
	public function Character() {
    
                var fillType:String = GradientType.LINEAR;
           //     var colors:Array = [0x00FF00,0xFF0000];
                var alphas:Array = [100,100];
                var ratios:Array = [0,255];
                
                graphics.beginFill(Math.random() * 255 * (Math.random() * 255) * 255, 1);
                graphics.drawCircle(0,0, 20);
                graphics.endFill();
                

               
	}
  
}