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: Blur Circle

@author ll_koba_ll (RAWHIDE.)
Get Adobe Flash player
by twistcube 18 Apr 2009
package
{
	import flash.display.* ;
	import flash.events.* ;
	import flash.geom.* ;
	import flash.filters.* ;

	/** 
	 * @author ll_koba_ll (RAWHIDE.)
	 */
	[SWF(frameRate="30", backgroundColor="#DCE6CB")]
	public class Rotationlight extends Sprite
	{
		private var blur:BlurFilter ;
		private var container:Sprite ;
		private var source:Sprite ;
		private var bmpd:BitmapData ;
		private var vect:Point ;
		private var spring:Number = .1 ;
		private var friction:Number = .9 ;
		
		public function Rotationlight( )
		{
			stage.scaleMode = StageScaleMode.NO_SCALE ;
			stage.align = StageAlign.TOP_LEFT ;
			//stage.quality = StageQuality.LOW ;
			
			init( ) ;
		}
		
		private function init( ):void
		{
			blur = new BlurFilter( 5, 5 ) ;			
			bmpd = new BitmapData( 500, 500, true, 0x00FFFFFF ) ;
			container = new Sprite( ) ;
			source = new Sprite( ) ;
			
			vect = new Point( 100 * Math.random( ) - 50, 100 * Math.random( ) - 50 ) ;
			
			source.x = stage.stageWidth / 2 ;
			source.y = stage.stageHeight / 2 ;
			source.graphics.beginFill( 0xDCE6CB ) ;
			source.graphics.drawCircle( 0, 0, 90 ) ;
			source.graphics.endFill( ) ;
			
			addChild( new Bitmap( bmpd ) ) ;
			container.addChild( source ) ;
			
			filters= [ new DropShadowFilter( 0, 45, 0x9AB48B, 1, 10, 10, 15 ) ] ;
			
			addEventListener( Event.ENTER_FRAME, update ) ;
		}
		
		private function update( e:Event ):void
		{
			var cach:BitmapData = bmpd.clone( ) ;
			
			var cTransForm:ColorTransform = new ColorTransform( 1, 1, 1, 0.85, 0, 0, 0, 0 ) ;
			// bmpd.fillRect( new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight ), 0xDCE6CB ) ;
			bmpd.fillRect( new Rectangle( 0, 0, stage.stageWidth+10, stage.stageHeight+10 ), 0xDCE6CB ) ;
			bmpd.draw( cach, null, cTransForm ) ;
			
			bmpd.applyFilter( bmpd, bmpd.rect, new Point( ), blur ) ;
			
			var cTransForm2:ColorTransform = new ColorTransform( 1, 1, 1, 1, 0, 0, 0, 0 ) ;
			bmpd.draw( container, null, cTransForm2, BlendMode.LIGHTEN ) ;
			vect.x += ( mouseX - source.x ) * spring ;
			vect.y += ( mouseY - source.y ) * spring ;
			vect.x *= friction ;
			vect.y *= friction ;
			source.x += vect.x ;
			source.y += vect.y ;
		}
	}
}