In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

BitmapDataのエフェクトお試し4

Get Adobe Flash player
by gaziya 21 Nov 2011
/**
 * Copyright gaziya ( http://wonderfl.net/user/gaziya )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/lQg2E
 */

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;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            graphics.beginFill(0xff8800)                
            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(0xaaff00)
                graphics.drawCircle(0,0,10)
            }
            addEventListener(Event.ENTER_FRAME, loop)
            var theta:Number = 0
            var radius:int = 100
            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 = 0xcc00ff
                shape.transform.colorTransform = color
                canvas.draw(stage,null,new ColorTransform(1,1,1,0.9))
                canvas.applyFilter(canvas, canvas.rect, new Point(), new BlurFilter(5, 5, 3))              
                shape.transform.colorTransform = new ColorTransform
                
            }            
        }
    }
}