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

Frozen Air

@OKASUKE
* 2010/05/27
* Filter Practice エフェクトの鍛錬
* Frozen Air (ガリガリ君の凍気[謎])
* Mouse on/off move
Get Adobe Flash player
by OKASUKE 27 May 2010
/**
 * Copyright OKASUKE ( http://wonderfl.net/user/OKASUKE )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/p1HD
 */

/*
* @OKASUKE
* 2010/05/27
* Filter Practice エフェクトの鍛錬
* Frozen Air (ガリガリ君の凍気[謎])
* Mouse on/off move
*/
package  
{
	import flash.display.Sprite;
	import flash.display.BlendMode;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.events.Event;
	import flash.events.MouseEvent;	
	import flash.geom.Point;
	import flash.geom.ColorTransform;
	import flash.geom.Matrix;
	import flash.geom.Rectangle;
	import flash.filters.ColorMatrixFilter;	
	import flash.filters.BlurFilter;	
	
	import net.hires.debug.Stats;

         
	[SWF(width=465, height=465, backgroundColor = 0x000000, frameRate = 30)]		
	public class WonTest2 extends Sprite
	{
		private var _shiten:Object = new Object();
		private var _Arrbox:Array = new Array();
		private var _Arrpoint:Array = new Array();
		private var _mflag:Boolean = false;
		private var _container:Sprite;
		private var _canvas:BitmapData;
		private var _effect:BitmapData;
		private var _forceMap:BitmapData;		
		private var _blurFilter:BlurFilter;			
		private var _colorTrans:ColorTransform;		
		private var _FilterMatrix:Matrix;
		private var _MainMatrix:Matrix;
		
		private static const COUNTER:Number = 100;			
		private static const RECT:Rectangle = new Rectangle(0, 0, 465, 465);
		private static const ZEROS:Point    = new Point(0, 0);
			
		public function WonTest2() 
		{				
			_shiten = { x:0, y:0, angle:0, zoom:0 }
			addChild(new Bitmap( _canvas = new BitmapData(465, 465, true, 0x0) ) ) as Bitmap;
			_effect = _canvas.clone();
			
			_blurFilter = new BlurFilter(20, 32, 1);			
			
			addpoint();
			_container = new Sprite();
			
			_FilterMatrix = new Matrix(0.9, -0.1, 0.1, 0.9, 15, 30);
			_colorTrans = new ColorTransform(0.1, 0.9, 0.9);
			_MainMatrix = new Matrix(1, 0, 0, 1, 0, 0);	
			
			addChild(new Stats());
			
			addEventListener(Event.ENTER_FRAME, render);
			stage.addEventListener(MouseEvent.MOUSE_DOWN, m_down);
			stage.addEventListener(MouseEvent.MOUSE_UP, m_up);			
		}
		
		private function addpoint():void {
			var point:Sprite; 		
			for (var i:int = 0; i < COUNTER; i++) {
				point = new Sprite();
				point.x = Math.random() * 300;
				point.y = Math.random() * 300;				
				addChild(point);
				point.visible = false;
				_Arrpoint[i] = point;								
			}
		}
		
		private var _count:uint = 0;
		
		private function render(e:Event):void {
			
			_shiten.angle += 0.05;			
			if(_shiten.zoom <= 3) _shiten.zoom += 0.03;
					
			var cos1:Number = Math.cos(_shiten.angle);
			var sin1:Number = Math.sin(_shiten.angle);
				
			for (var i:int = 0; i < COUNTER; ++i) 
			{
				
				_shiten.x = mouseX;
				_shiten.y = mouseY;				
				var sa_x:Number = _Arrpoint[i].x - _shiten.x;
				var sa_y:Number = _Arrpoint[i].y - _shiten.y;
			
				en = new EnObj();
				if(_mflag)	en.createEnObj(0, 0, _mflag); 				
				else en.createEnObj(0, 0, _mflag);
				
				_container.addChild(en);				
			
				en.scaleX = en.scaleY = _shiten.zoom;
				
				if (_mflag) {
					en.x = sa_x * sin1 - sa_y * sin1 + 222;
					en.y = sa_x * cos1 + sa_y * cos1 + 222; 
				} else { 
					en.x = sa_x * sin1 + sa_y * cos1 + 222;
					en.y = sa_x * cos1 - sa_y * sin1 + 222; 
					//en.z = sa_x * cos1 + sa_y * cos1 + 222//・・・orz
				}
				
				_Arrbox.push(en);
				
				_count += 1;
				if (_count > COUNTER * 10) _container.removeChildAt(_Arrbox.splice(0, 1)[0]);
			}		
				
			_canvas.lock();	
			_effect.lock();	
			
			_canvas.fillRect(RECT, 0x0);
			_canvas.draw(_container, _MainMatrix);	
			
			_effect.copyPixels(_canvas, RECT, ZEROS);
			_effect.draw(_canvas, _FilterMatrix, _colorTrans, BlendMode.ADD);
			_effect.applyFilter(_effect, RECT, ZEROS, _blurFilter);			
			_canvas.draw(_effect);
			
			_effect.unlock();
			_canvas.unlock();		
			
		}
		
		private var en:EnObj;		
	
		private function m_down(e:MouseEvent):void {
			_mflag = true;					
		}
		
		private function m_up(e:MouseEvent):void {
			_mflag = false
		}
	}		
}

import flash.display.Sprite;
import flash.display.Shape;
import flash.display.Graphics;

internal class EnObj extends Sprite {
		
	private var g:Graphics = graphics;	
	
	public function EnObj() {}
	
	public function createEnObj(x:int, y:int, flg:Boolean):void {
		//0x7FFFD4
		g.beginFill(0x7FFFD4, 1);		
		g.drawRect(x, y, 2.5, 4);		 		
		g.endFill();
	}	
	
	public function crearEnObj():void {
		g.clear();
	}
}