Rotating Objects with Filters : Gradient : Graphics Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Graphics » Gradient »

 

Rotating Objects with Filters


 

package
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import flash.filters.BlurFilter;
    import flash.geom.Matrix;
    public class Main extends Sprite
    {
        private var circle:Sprite = new Sprite();
        private var circleCopy:Sprite = new Sprite();
    
        public function Main()
        {
            addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
            circle.graphics.beginFill(0x00FF001);
            circle.graphics.drawCircle(0015);
            circle.graphics.endFill();
            addChild(circle);
            var bfInstance:BlurFilter = new BlurFilter(1040);
            circle.filters = [bfInstance];
            var bmpDataCircle:BitmapData = new BitmapData(circle.width + 20, circle.height + 80);
            bmpDataCircle.draw(circle, new Matrix(10011040));
            var bmpCircle:Bitmap = new Bitmap(bmpDataCircle);
            circle.visible = false;
            circleCopy.addChild(bmpCircle);
            addChild(circleCopy);
    
        }
    
        private function onMouseMove(mouseEvent:MouseEvent):void
        {
                circleCopy.rotation = (mouseX / 550360;
        }
    }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Graphics
» Gradient