GTweenに用意されているproxyプロパティを使ってみました。
サンプル無いから使い方分かんないと思っていましたがAPIドキュメントに書いてありました。
使い方が分かるとかなり便利な機能でした。
Tween対象のプロパティを後で決めることが可能になります。
import com.gskinner.motion.GTween; import com.gskinner.motion.easing.*; import com.gskinner.motion.plugins.*; import flash.events.MouseEvent; ColorTransformPlugin.install(); var gt:GTween = new GTween(target_mc, 1, null, {ease:Sine.easeOut, onComplete:onGTComplete}); function onGTComplete (g:GTween):void { trace(g); } x_btn.addEventListener(MouseEvent.CLICK, onClick); y_btn.addEventListener(MouseEvent.CLICK, onClick); color_btn.addEventListener(MouseEvent.CLICK, onClick); function onClick (e:MouseEvent):void { switch (e.target.label.toLowerCase()) { case "x" : gt.proxy.x = (stage.stageWidth - target_mc.width) * Math.random(); break; case "y" : gt.proxy.y = (stage.stageHeight - target_mc.height) * Math.random(); break; case "color" : gt.proxy.tint = 0xffffffff * Math.random(); break; } } |
Fade In / Out しなくちゃ行けない時に便利に使えそう。