Can I dynamically add an event to an animation at a specified time in the code so that it can trigger the dynamically added event when it is played next? Also, dynamically remove this added event
Dynamically add events
Yes, you can dynamically add events to an animation through code. To do this, you would need to create an EventTimeline
and add it to the animation's timelines. You can then add keyframes to this event timeline at the specified times. This allows you to trigger events at specific times during the animation. To remove an event, you would need to modify the EventTimeline
to remove the specific keyframes or the entire timeline if needed. This process can be done programmatically, but it requires managing the timelines and events manually in your code.
youling Unfortunately, Spinebot is programmed to reply only once when a thread is created, so it does not respond to replies.
You can simply create a new EventTimeline
and Event
and then set that event to a specific frame with the setFrame
method. Then, add the timeline to a specific animation's timelines
.
You may want to refer to the spine-cpp code to see how the timeline of events works:
EsotericSoftware/spine-runtimesblob/06f6e1473cdfc77e319c24674735b4c1523fd6fa/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp#L1539-L1563