sample 5 soundkitchen.. forked:12favorite:0lines:54license : MIT License modified : 2009-11-03 21:07:55 Embed Tweet package { import flash.display.Sprite; import flash.events.MouseEvent; import flash.filters.DropShadowFilter; import caurina.transitions.Tweener; import caurina.transitions.properties.FilterShortcuts; [SWF(width=465, height=465, frameRate=30, backgroundColor=0xFFFFFF)] public class Sample extends Sprite { public static const STD_POINT:Number = 150; public static const STD_DISTANCE:Number = 32; public static const STD_BLUR:Number = 32; private var light:Sprite; private var ball:Sprite; public function Sample():void { // FilterShortcuts を有効化 FilterShortcuts.init(); // light を作成 light = new Sprite(); light.x = stage.stageWidth / 2; light.y = stage.stageHeight / 2; light.graphics.beginFill(0xFF0000); light.graphics.drawCircle(0, 0, 20); light.graphics.endFill(); addChild(light); // ball を作成 ball = new Sprite(); ball.x = light.x; ball.y = light.y; ball.filters = [new DropShadowFilter(0, 0, 0, .5, 0, 0)]; ball.graphics.beginFill(0); ball.graphics.drawCircle(0, 0, 20); ball.graphics.endFill(); addChild(ball); // stage のクリックイベントにリスナーを登録 stage.addEventListener(MouseEvent.CLICK, clickHandler); } private function clickHandler(evt:MouseEvent):void { var dx:Number = mouseX - light.x; var dy:Number = mouseY - light.y; var dp:Number = Math.sqrt(dx*dx + dy*dy) / STD_POINT; var degrees:Number = Math.atan2(dy, dx) / Math.PI * 180; Tweener.addTween(ball, { x: mouseX, y: mouseY, _DropShadow_angle: degrees, _DropShadow_distance: dp * STD_DISTANCE, _DropShadow_blurX: dp * STD_BLUR, _DropShadow_blurY: dp * STD_BLUR, time: 1, transition: "easeInOutCubic" }); } } } Code Fullscreen Preview Fullscreen Wonderfl本 FilterShortcuts.init mouseY mouseX DropShadowFilter filters Math.atan2 MouseEvent.CLICK Math.sqrt addChild Tweener.addTween time MouseEvent addEventListener Math.PI Sprite Number sort new page view favorite forked pv36 forked from: sample 5 irishoak forked:0 favorite:0lines:54 (diff:1) pv61 forked from: sample 5 tanigami forked:0 favorite:0lines:54 (diff:1) pv75 forked from: sample 5 hacker_85_mvfk5 forked:1 favorite:0lines:54 (diff:1) pv75 forked from: sample 5 hacker_xaotp5zq forked:0 favorite:1lines:54 (diff:2) pv180 forked from: sample 5 rettuce forked:0 favorite:0lines:66 (diff:16) pv66 forked from: sample 5 aass forked:0 favorite:0lines:54 (diff:1) pv100 forked from: sample 5 m_keita forked:0 favorite:0lines:54 (diff:1) pv91 forked from: sample 5 ieha forked:0 favorite:0lines:54 (diff:1) 1 2NEXT