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(0x00FF00, 1); circle.graphics.drawCircle(0, 0, 15); circle.graphics.endFill(); addChild(circle); var bfInstance:BlurFilter = new BlurFilter(10, 40); circle.filters = [bfInstance]; var bmpDataCircle:BitmapData = new BitmapData(circle.width + 20, circle.height + 80); bmpDataCircle.draw(circle, new Matrix(1, 0, 0, 1, 10, 40)); var bmpCircle:Bitmap = new Bitmap(bmpDataCircle); circle.visible = false; circleCopy.addChild(bmpCircle); addChild(circleCopy); } private function onMouseMove(mouseEvent:MouseEvent):void { circleCopy.rotation = (mouseX / 550) * 360; } } }
|
|
|
|
|
Related Scripts with Example Source Code in same category :
-
-
-
-
-
-
-
-
lineGradientStyle("radial", [0xFFFF00, 0x00FFFF], [100, 100], [0x00, 0xFF], mxBox, "pad", "linearRGB", 1)
-
-
|
|