forked from: BitmapDataのエフェクトお試し4
/**
* Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2Kky
*/
package
{
import flash.filters.BlurFilter;
import flash.geom.Point;
import flash.geom.ColorTransform;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.Event;
import flash.display.Shape;
import flash.display.Sprite;
import frocessing.color.ColorHSV;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class FlashTest extends Sprite
{
private var color:ColorHSV;
private var timer:Timer;
private var colorTrans:ColorTransform;
public function FlashTest()
{
color = new ColorHSV(0);
colorTrans = new ColorTransform();
graphics.beginFill(0x000000)
graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight)
var canvas:BitmapData=new BitmapData(stage.stageWidth,stage.stageHeight,true,0x0)
addChild(new Bitmap(canvas))
var shape:Shape = addChild(new Shape) as Shape
with (shape)
{
graphics.beginFill( 0x000000,1 )
graphics.drawCircle( 0,0,60 )
}
addEventListener(Event.ENTER_FRAME, loop)
var theta:Number = 1.0;
var radius:int = 30;
function loop(e:Event):void
{
shape.x = radius*Math.cos(theta)+stage.stageWidth/2
shape.y = radius*Math.sin(theta)+stage.stageHeight/2
theta += 0.02*Math.PI
theta %= 2*Math.PI
var color:ColorTransform = new ColorTransform
//color.color = 0xFFFFFF*Math.random()
//color.color = 0xcc00ff
color.color = 0x0000ff
shape.transform.colorTransform = color
canvas.draw(stage,null,new ColorTransform(1,1,1,0.98))
canvas.applyFilter(canvas, canvas.rect, new Point(), new BlurFilter(10, 10, 3))
shape.transform.colorTransform = new ColorTransform
}
}
}
}