MarkLight (AssetStore)
MarkLight Document (英語)
コード内でアニメーションを動的に生成したい時はここ(Creating Animations in Code)に記載があります。
以下、そのまま抜粋
var offsetAnimator = new ViewFieldAnimator(); // set up animation offsetAnimator.EasingFunction = EasingFunctionType.QuadraticEaseOut; offsetAnimator.Field = "Offset"; // the field that is to be animated offsetAnimator.From = new ElementMargin(); offsetAnimator.To = new ElementMargin(x, y, 0, 0); // x and y set during runtime offsetAnimator.Duration = 0.2f; // duration in seconds offsetAnimator.TargetView = MyRegion; // the view whose Offset field is to be animated // start animation offsetAnimator.StartAnimation();
ただ、このままアニメーションしたいタイミングの箇所に記載しても動作しません。。。
TargetViewのUpdateに以下を記述する必要があります!
ViewFieldAnimator offsetAnimator; void Update () { if(offsetAnimator != null && offsetAnimator.IsRunning) offsetAnimator.Update (); }
当然、var offsetAnimator = 〜としていた箇所はメンバ変数を見るよう修正してください!
0 件のコメント:
コメントを投稿