BlurMaskTest (2)

by ProjectNya
♥0 | Line 40 | Modified 2010-09-04 16:47:22 | MIT License
play

ActionScript3 source code

/**
 * Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/fp3b
 */

package {

    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.events.Event;
    import flash.filters.BlurFilter;
    import flash.events.MouseEvent;

    [SWF(backgroundColor="#FFFFFF", width="465", height="465", frameRate="30")]

    public class Main extends Sprite {
        private var container:Sprite;
        private var rect:Shape;
        private var circle:Shape;

        public function Main() {
            //Wonderfl.capture_delay(1);
            init();
        }

        private function init():void {
            container = new Sprite();
            addChild(container);
            rect = new Shape();
            container.addChild(rect);
            rect.x = 232;
            rect.y = 232;
            rect.graphics.beginFill(0xFF0000);
            rect.graphics.drawRect(-100, -100, 200, 200);
            rect.graphics.endFill();
            rect.filters = [new BlurFilter(4, 4, 2)];
            circle = new Shape();
            addChild(circle);
            circle.x = 232;
            circle.y = 232;
            circle.graphics.beginFill(0x000000);
            circle.graphics.drawCircle(0, 0, 120);
            circle.graphics.endFill();
            container.mask = circle;
            addEventListener(Event.ENTER_FRAME, update, false, 0, true);
        }
        private function update(evt:Event):void {
            rect.rotation += 2;
        }

    }

}