function init(self)
gui.set_enabled(gui.get_node("explo"), false)
self.nodes = {}
for i = 1, 100 do
self.nodes[i] = gui.clone(gui.get_node("explo"))
-- CASE1
--gui.play_spine_anim(self.nodes[i], "Particle_explosion", gui.PLAYBACK_ONCE_FORWARD)
end
self.index = 1
end
function update(self, dt)
self.t = (self.t or 1) - dt
if self.t < 0 then
self.t = 1
local node = self.nodes[self.index]
self.index = self.index + 1
-- CASE 2
--timer.delay(0.0001, false, function()
gui.set_enabled(node, true)
gui.play_spine_anim(node, "Particle_explosion", gui.PLAYBACK_ONCE_FORWARD, {}, function()
gui.delete_node(node)
end)
--end)
end
end
If i run this code, i got the bug
If i uncomment CASE1 (preplay animation) all will be ok
If i uncomment CASE2 (enable node and play in timer callback) all will be ok
What it can be? Why it is works ok with timer? After node cloning and playing about 1 second. Cant understand why timer affected on this.
Without cloning its glitched too on first animation play
What happens is that the spines “initial” state is shown for one frame. It works with preplaying it because then you are skipping the initial state.
Why it works with the timer I can only guess, I guess it delays playing the spine and therefore it somehow makes the spine skip the “initial” frame.
You can fix this by having a better initial state for your spine. We usually have a “empty idle” or something similar and set that as the default animation.
We have had quite a bit of problem with this (most recently today actually) and it didn’t use to do this. I think it might have started to happen at 1.2.127 or even 1.2.123 can’t remember exactly. I remember it made me go trough a lot of spine scenes and set a better “default animation” so that we wouldn’t get this little glitch everywhere.
Update:
We did some further testing and this does’t seem to be entirely true (at least for GUI). We have a spine that is playing an animation that is starting of screen, and we still see a frame of it in a “setup” stage or something.
The only thing that seemed to help our case is to have it disabled in the init and when playing the animation doing
What is the default animation set to on the component/spine node? I would suspect that at the time of it spawning it should display the first frame of the animation that is currently “playing”, if not it certainly sounds like a bug.
Yea, correct
Default animation, as i know, start to play after node init. So it is seems like the CASE1 from the code.
If I play animations in the first second after init (with default animation), there is will be glitch too