forked from: flash on 2010-2-12
[SWF (backgroundColor='#000000', frameRate=30)]
/**
* Copyright ohisama ( http://wonderfl.net/user/ohisama )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/soc8
*/
// forked from hiro_rec's flash on 2010-2-12
package
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BlendMode;
import flash.display.Sprite;
import flash.events.AsyncErrorEvent;
import flash.events.Event;
import flash.events.NetStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.filters.GlowFilter;
import flash.filters.GradientGlowFilter;
import flash.geom.Point;
import net.hires.debug.Stats;
[SWF (backgroundColor='#000000', frameRate=30)]
public class Glow01 extends Sprite
{
private var container : Sprite;
private var circle : Sprite;
private var bmd : BitmapData;
private var bmp : Bitmap;
public function Glow01()
{
stage.addChild(new Stats());
initDisplay();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
private function initDisplay() : void
{
graphics.beginFill(0x2f2f2f);
graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
container = new Sprite();
circle = new Sprite()
circle.graphics.beginFill(0xFFFFFF)
circle.graphics.drawCircle(0, 0, 20);
container.addChild(circle);
bmd = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x00000000);
bmp = new Bitmap();
bmp.bitmapData = bmd;
bmp.blendMode = BlendMode.ADD;
addChild(bmp);
}
private function enterFrameHandler(event : Event) : void
{
bmd.draw(container);
circle.x = mouseX;
circle.y = mouseY;
var point : Point = new Point();
bmd.threshold(bmd, bmd.rect, point, "<", 0x00333333, 0x00000000, 0x00FF0000, true);
var matrix : Array = [
1, 0, 0, 0, 0,
0, 1, 0, 0, 5,
0, 0, 1, 0, 2,
0, 0, 0, 1, -5
];
var matrixFilter : ColorMatrixFilter = new ColorMatrixFilter(matrix);
bmd.applyFilter(bmd, bmd.rect, point, new GlowFilter(0x0000FF, 1, 6, 6, 20));
//bmd.applyFilter(bmd, bmd.rect, point, new GlowFilter(0x00ccff, 1, 6, 6, 10));
bmd.applyFilter(bmd, bmd.rect, point, new BlurFilter(7, 7));
bmd.applyFilter(bmd, bmd.rect, point, matrixFilter);
bmd.applyFilter(bmd, bmd.rect, point, new GlowFilter(0x2375fd, 10, 10, 1, 5));
}
}
}