forked from: お試し
// forked from kimu's お試し
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.display.BlendMode;
import flash.filters.BlurFilter;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.geom.ColorTransform;
[SWF(width=465,height=465,backgroundColor=0x000000,frameRate=30)]
public class GraphicTest extends Sprite {
private var grahpicSprite:Sprite;
private var blurBitmap:Bitmap;
private var blurBitmapData:BitmapData;
private var lastMouseX:Number;
private var lastMouseY:Number;
private var blendModes:Array;
public function GraphicTest() {
//blendModes = [BlendMode.ADD,BlendMode.MULTIPLY,BlendMode.OVERLAY];
blendModes = [BlendMode.ADD, BlendMode.MULTIPLY, BlendMode.OVERLAY];
blurBitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,true,0);
blurBitmap = new Bitmap(blurBitmapData);
blurBitmap.y = -2;
blurBitmap.filters = [new BlurFilter(10,10,3)];
addChild(blurBitmap);
grahpicSprite = new Sprite();
addChild(grahpicSprite);
addEventListener(Event.ENTER_FRAME,drawLine);
}
public function drawLine(e:Event):void {
blurBitmapData.draw(this,null,null,blendModes[Math.floor(Math.random()*(blendModes.length-1))]);
grahpicSprite.graphics.clear();
if ( lastMouseX == mouseX && lastMouseY == mouseY ) return;
grahpicSprite.graphics.beginFill(Math.random()*255*Math.random()*255*Math.random()*255);
grahpicSprite.graphics.drawCircle(mouseX,mouseY,10);
grahpicSprite.graphics.endFill();
lastMouseX = mouseX;
lastMouseY = mouseY;
}
}
}