flash on 2009-7-18
/**
* Copyright hiro_rec ( http://wonderfl.net/user/hiro_rec )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/aKST
*/
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 flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
[SWF (backgroundColor='#FFFFFF', frameRate=30)]
public class Main extends Sprite
{
private var container:Sprite;
private var circle:Sprite;
private var bmd:BitmapData;
private var bmp:Bitmap;
public function Main()
{
initDisplay();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
private function initDisplay():void
{
container = new Sprite();
circle = new Sprite()
circle.graphics.beginFill(0xFF0000)
circle.graphics.drawCircle(0, 0, 35);
container.addChild(circle);
bmd = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x00000000);
bmp = new Bitmap();
bmp.bitmapData = bmd;
bmp.blendMode = BlendMode.HARDLIGHT;
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(0x00FF00, 1, 6, 6, 20));
bmd.applyFilter(bmd, bmd.rect, point, new GlowFilter(0x0011FF, 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(0x0000FF, 3, 3, 1, 5));
}
}
}