Sprites flickering with go.animate on alpha property

This has happened on two projects now: I cannot smoothly animate sprites to and from alpha. It seems that some easing options make them smoother and others do not. I made a screencapture of their behaviour, here is the code:

local function animate_motes()
	local mote_fadetime = 3
	local mote_lifetime = 8
	go.animate("#sprite", "tint.w", go.PLAYBACK_ONCE_FORWARD, 1, go.EASING_INCUBIC, mote_fadetime)
	go.animate(".", "euler.z", go.PLAYBACK_LOOP_FORWARD, 360, go.EASING_LINEAR, mote_lifetime)

	local random_x = math.random(-const.half_width, const.half_width)
	local random_y = math.random(-180, const.half_height)
	local dance_path = vmath.vector3(random_x, random_y, 0)
	go.animate(".", "position", go.PLAYBACK_ONCE_FORWARD, dance_path, go.EASING_INOUTCUBIC, mote_lifetime * 2)

	go.animate("#sprite", "tint.w", go.PLAYBACK_ONCE_FORWARD, 0, go.EASING_INCUBIC, mote_fadetime, mote_lifetime, function()
		go.delete()
	end)
end

Note that the only reason I don’t use go.easing_linear is because it seems smoother with InCubic.
Setup: Single GO with an own atlas of the five sprites. The above code sits in the motes’ behaviour script, attached to the prototype GO for the factory, and is called in its init function.
An overlay in the start screen that animates a large node from alpha 0 does not show this behaviour.

It looks a bit like z-fighting… Do the motes have exactly the same z position as the background?

3 Likes

Weirdly, setting z to full 1 still had them flicker but values in between work, apparently. Thanks! Hopefully it stays this way :wink: (Also, I could’ve sworn I tried that ^_^')

3 Likes