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

Invert Test

2010.01.04
*1日目
Get Adobe Flash player
by glasses_factory 04 Jan 2010
/**
 * Copyright glasses_factory ( http://wonderfl.net/user/glasses_factory )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/lzJ3
 */

/**
 *2010.01.04
 *1日目
 */

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
        [SWF(width=465, height=465, frameRate=30, backgroundColor=0)]
	public class Study1 extends Sprite
	{
		/*//////////////////////////////////////
		/*	public methods
		/*//////////////////////////////////////
		
		//Constractor
		public function Study1()
		{
        		super();
			init();
		}
		
		
		/*//////////////////////////////////////
		/*	private methods
		/*//////////////////////////////////////

                private function init():void
		{
			var _col:uint;
			_bubbleAry = [];
			for( var i:int = 0; i < NUM; ++i )
			{
				var b:Bubble = new Bubble();
				b.x = b.fx = stage.stageWidth * Math.random();
				b.y = b.fy = stage.stageHeight * Math.random();
				addChild( b );
				_bubbleAry.push( b );
			}
			addEventListener( Event.ENTER_FRAME, mouseEscape );
		}
		
		private function mouseEscape( e:Event ):void
		{
			for( var i:int = 0; i < NUM; ++i )
			{
				var b:Bubble = _bubbleAry[i] as Bubble;
				var dmx:Number = stage.mouseX - b.x;
				var dmy:Number = stage.mouseY - b.y;
				var dist:Number = Math.sqrt( dmx * dmx + dmy * dmy );
				var amx:Number = dmx / dist * 200 / dist;
				var amy:Number = dmy / dist * 200 / dist;
				b.vx = b.vx * 0.98 + amx;
				b.vy = b.vy * 0.98 + amy;
				b.x += ( b.fx - ( b.x + b.vx )) * 1.5;
				b.y += ( b.fy - ( b.y + b.vy )) * 1.5;
			}
		}
		
		
		/*//////////////////////////////////////
		/*	private variables
		/*//////////////////////////////////////
		
		private const NUM:uint = 77;
		
		private var _bubbleAry:Array;
	}
}

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


class Bubble extends Sprite
{
	public function Bubble()
	{
		var g:Graphics = this.graphics;
		g.beginFill( 0 );
		g.drawCircle( 0, 0, Math.random() * 100 + 50 );
		g.endFill();
		this.blendMode = "invert";
	}
	
	public var vx:Number = 0;
	public var vy:Number = 0;
	public var fx:Number = 0;
	public var fy:Number = 0;
}