前回に続き Go + HydroTween と Tweensy に同じモーションを設定し動かしてみた。
x と roation に 色遷移を加えた。
Tweensy 使用法の理解が少ないのかもしれないけど・・・
位置と回転と色のモーションを同じインスタンスに対し同時に行おうとした場合、Tweensy は設定手順が面倒くさい。
何をモーションさせるかによって使うべき関数を使いわけなくてはいけない(?)ことが要因かも。
回転させるのに Matrix、色遷移には ColorTransform を使うことを知っていないといけない。
Tweensy duration:0 だと予測不能の結果になるよう、duration:0 を使ってはイケナイ。
実は、HydroTween も duration:0 で想定外の動きになることがある、まだどの条件下だとそうなるのか解明できてはいない。
Tweensy は「必ず」なので気をつけとこ。
[swfobj src=”http://www.inazumatv.com/contents/wp-content/uploads/2009/04/tweensy-hydrotween-compare-4.swf” width=”600″ height=”300″ id=”tweensy-hydrotween-color” name=”tweensy_hydrotween_color” class=”tweensy-hydrotween-color” align=”none” allowfullscreen=”false” required_player_version=”9.0.28″ bgcolor=”#cccccc”]
動きの軽やかさはTweensyだなぁ。
import fl.motion.easing.*; // Tweensy import com.flashdynamix.motion.*; import com.flashdynamix.motion.extras.MatrixTransform; var tween:TweensyGroup = new TweensyGroup(); var mtx:MatrixTransform = new MatrixTransform(target); mtx.registrationX = target.x + target.width/2; mtx.registrationY = target.y + target.height/2; var tweensy:TweensyTimeline = tween.to(mtx, {degree:360, tx:500}, 2.0, Sine.easeOut); tweensy.repeatType = TweensyTimeline.LOOP; // Tweensy color var ct:ColorTransform = target.transform.colorTransform; ct.color = 0xFF3366; var tweensy2:TweensyTimeline = tween.to(target.transform.colorTransform, ct, 2.0, Sine.easeOut, 0, target); tweensy2.repeatType = TweensyTimeline.LOOP; // HydroTween import org.goasap.interfaces.IPlayable; import com.hydrotik.go.*; HydroTween.VERBOSE = false; var hydro:IPlayable = HydroTween.go( target2, {rotation:360, x:525, color:0xFF3366}, 2.0, 0.0, Sine.easeOut , null, null, null, null, null , {cycles:0,reverse:true,easing:null} ); |