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のエフェクトお試し3

new BitmapData()の3番目の入力をtrue、4番目を0にするとbitmapが透明になる。それからBitmapDataのcolorTransformのアルファ値を下げていくのが、ポイントのようだ。
Get Adobe Flash player
by gaziya 22 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/1OJF
 */

package {
    import flash.geom.ColorTransform;
    import flash.geom.Matrix;
    import flash.events.Event;
    import flash.display.Shape;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            graphics.beginFill(0x00ff00)                
            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 = new Shape
            with (shape) {
                graphics.beginFill(0xff)
                graphics.drawCircle(100,0,10)                
            }
            addEventListener(Event.ENTER_FRAME, loop)
            var theta:Number = 0
            function loop(e:Event):void {
                var colorTransform:ColorTransform = new ColorTransform
                colorTransform.alphaMultiplier = 0.9
                canvas.colorTransform(canvas.rect, colorTransform)
                var matrix:Matrix = new Matrix
                matrix.rotate(theta)
                matrix.translate(stage.stageWidth/2,stage.stageHeight/2)
                canvas.draw(shape,matrix)
                theta += 0.02*Math.PI
                theta %= 2*Math.PI
            }            
        }
    }
}