Hello Guest

Author Topic: Animation Events Example in JS  (Read 3486 times)

luniac

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 23
    • View Profile
Animation Events Example in JS
« on: November 28, 2014, 11:27:32 pm »

Hi, can i get a basic example of using animation events in JS?

The documentation code is in C#
anim.AnimationEventTriggered = HandleAnimationEvent;

    void HandleAnimationEvent(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNo) {
        tk2dSpriteAnimationFrame frame = clip.GetFrame( frameNo );
        Debug.Log( frame.eventInt );
    }



I get that i attach the script to the object with the spriteanimator but the example JS script doesn't have any event callback syntax, and I'm not sure how to do it.

http://www.unikronsoftware.com/2dtoolkit/docs/latest/tutorial/scripting_a_sprite_animator.html

Is there some simple way to check callback like:
OnAnimationEvent(eventdata : data){
 if(eventdata.info = FRAME3){
    CODE
 }
}


I just need a super basic example. Thanks :)
« Last Edit: November 28, 2014, 11:33:38 pm by luniac »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Animation Events Example in JS
« Reply #1 on: November 29, 2014, 11:26:29 am »