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

spring01

研究室内勉強会: バネその1
Get Adobe Flash player
by sakef 01 Jun 2010
    Embed
/**
 * Copyright sakef ( http://wonderfl.net/user/sakef )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/10kk
 */

/*
	研究室内勉強会: バネその1
*/
package
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	[SWF(width="465", height="465", backgroundColor="0x000000", frameRate="30")]
	public class bane01 extends Sprite
	{
		private var sp:Sprite;
		private var vx:Number=0;
		private var vy:Number=0;
		private var k:Number=0.2;
		private var f:Number=0.9;
		
		public function bane01()
		{
			sp=new Sprite;
			sp.graphics.beginFill(0x00ff00, 1);
			sp.graphics.drawCircle(0, 0, 10);
			sp.graphics.endFill();
			addChild(sp);
			
			addEventListener(Event.ENTER_FRAME, onFrame);
		}
		
		private function onFrame(e:Event):void
		{
			vx+=(mouseX - sp.x) * k;
			vy+=(mouseY - sp.y) * k;
			
			sp.x+=vx;
			sp.y+=vy;
			
			vx*=f;
			vy*=f;
		}
	}
}