forked from: forked from: Blur Circle
そんなことないよーちゃんとENTER_FRAMEで実行されてるよ!
@WinXP FF3.0.4 WIN 9,0,124,0
// forked from mash's forked from: Blur Circle
// forked from ll_koba_ll's Blur Circle
// そんなことないよーちゃんとENTER_FRAMEで実行されてるよ!
// @WinXP FF3.0.4 WIN 9,0,124,0
package
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
// なぜかクリックしないと描画されない><
[SWF(width="300", height="300", frameRate="24", backgroundColor="#000000")]
/**
*
* @author ll_koba_ll (RAWHIDE.)
*/
public class Rotationlight extends Sprite
{
private var blur:BlurFilter;
private var container:Sprite;
private var source:Sprite;
private var bmpd:BitmapData;
public function Rotationlight()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.quality = StageQuality.LOW;
init();
addEventListener(Event.ENTER_FRAME, update);
}
private function init():void
{
blur = new BlurFilter(4,4);
bmpd = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x00FFFFFF);
container = new Sprite();
source = new Sprite();
addChild(new Bitmap(bmpd));
container.addChild(source);
with(source.graphics)
{
beginFill( 0xFFFFFF );
drawCircle(0,0,20);
endFill();
}
}
private var delta:Point = new Point;
private var color:ColorTransform = new ColorTransform (
Math.random (), Math.random (), Math.random ());
private function update(e:Event = null):void
{
bmpd.draw(container, null, null, BlendMode.SCREEN);
bmpd.applyFilter(bmpd, bmpd.rect, new Point(), blur);
// this change ensures there's no gaps between circles
delta.x = mouseX - source.x; delta.y = mouseY - source.y;
if (delta.length > 5) delta.normalize (5);
source.x += delta.x; source.y += delta.y;
// this should give some change to colors over time
color.redMultiplier = Math.min (1, Math.max (0, color.redMultiplier +
0.1 * (Math.random () - Math.random ()) ));
color.greenMultiplier = Math.min (1, Math.max (0, color.greenMultiplier +
0.1 * (Math.random () - Math.random ()) ));
color.blueMultiplier = Math.min (1, Math.max (0, color.blueMultiplier +
0.1 * (Math.random () - Math.random ()) ));
source.transform.colorTransform = color;
}
}
}