• Editor
  • new feature: event timeline

The event timeline allows events to be triggered at specific times during an animation. These events can be used for anything at runtime. For example, spawning particles or playing a sound.

To use events, first create a new event under the Events node. In setup mode, you can set up an int, float, and string value for the event, if needed. In animate mode, you can click the key dot in the tree next to the event to set an event key at the current timeline position. You can also change the int, float, and string value before setting a key, which allows you to have per key values if the setup mode event values are not sufficient for your needs.

At runtime, when an animation is applied (or mixed) the parameters have changed. It used to be:

apply (Skeleton skeleton, float time, boolean loop)
mix (Skeleton skeleton, float time, boolean loop, float alpha)

Now it is:

apply (Skeleton skeleton, float lastTime, float time, boolean loop, List<Event> events)
mix (Skeleton skeleton, float lastTime, float time, boolean loop, List<Event> events, float alpha)

"lastTime" and "events" are new. Any events between "lastTime" and "time" will be added to the events list, so you probably want to clear the list before calling these methods. You can then iterate the events, inspect their name, int, float, and string values, and take whatever action you like. If you don't care about events you can pass a very high value for "lastTime" and null for "events" (since a very high "lastTime" means no events will ever be triggered).

If using AnimationState, then nothing changes, internally it does this for you. How the AnimationState lets you know about events is runtime specific. Some runtimes use a listener, others may return the events list. Only the current animation fires events, no events are fired from the old animation even if it is being mixed.

Related Discussions
...

Does this imply that the feature is supported in the runtimes? or only in the editor for now?

I've looked at the lua and corona runtimes and they don't seem to contain this update (they haven't been updated at all in the last couple of days).

We are very excited about this new feature and want to use it in our upcoming game which is almost done.

We plan to use it in order to emit particles (dust/smoke mini clouds when the character hits the ground) and sounds (voices when the character moves the mouth). This could benefit us greatly!!

Great news that it is available in the editor - do you have a timeline for use in Unity C# spine tk2d?

Hi, any news when you estimate the spine runtimes to be updated and in what order for the event timeline...

Thanks

anything I can do to help with the runtimes...? guessing spinec would be gateway to getting a few done.

The libgdx runtime is still fluctuating. Once it has all the features I want, then I'll port it to all the other runtimes. Not sure yet, a few days probably.

12 days later

Any updates on ETA for updated runtimes? Ive been checking hourly for last 8 days hehe 🙂

Unfortunately I had to fix some other things and bounding boxes are taking a while to get done. I would like to finish bounding boxes so that I only have to go thru all the runtimes once to do events, keyable draw order, and bounding boxes.

17 days later

Awesome! We're looking forward to that next batch of runtime updates. We're using the cocos2d runtime at the moment (in lew of a sprite kit runtime), and are looking forward to using events to trigger things things like sound effects and particle explosions.

Is free-form def going to be batched up in that runtime update with events/keyable/bounding ?
Just curious if lumping it all together.

Thanks!

FFD probably won't be in the next runtime updates, unfortunately.

9 days later

Nate, I know you have been busy, but how are you doing with the runtime support for events, specifically c#, tk2d for unity? I have told the animators we are done using key frame numbers to support animations!

spine-csharp has bounding boxes, keyable draw order, etc


everything except for events, which I should have done tomorrow. 🙂

11 days later

Hi,

Sorry to pop-up the topic, but when this feature will be available for all the runtime ? I'm especially waiting the AS3/Starling runtime but I have no idea when it will be done. To be honest I'm currently working on a new project and I'm really counting on that feature.

Thank you

I was pushing to events for all the runtimes. I got thru libgdx, C#, c, cocos2d, cocos2dx, and Unity, then got sidetracked by fixing up bugs. At least fixing these bugs means the features are more stable for the remaining runtimes! The last few days I've been totally unable to code, having to do horrible non-coding tasks like responding to forum posts and emails, and businessy stuff. 🙁 I hope to be back to working on the runtimes in a day or two, it won't be much longer than that for AS3.