GUI Animation Sequence

I’m trying to get a sequence of GUI animations to work, however, can’t get the second function to be called once the first animation is finish. I’ve looked through the API reference and can’t figure out what I’ve done wrong. Any help much appreciated.

function animateLogo(self)
	local gameLogo = gui.get_node("splashBackground")
	print("executing game logo sequence")
	-- start scale
	local s = 1.1
	gui.set_scale(gameLogo, vmath.vector4(s, s, s, 0), gui.EASING_IN, 4, 0)
	-- increase size of logo
	local s1 = 1.5
	gui.animate(gameLogo, gui.PROP_SCALE, vmath.vector4(s1, s1, s1, 0), gui.EASING_IN, 4, 0, animateLogo2)
end

local function animateLogo2(self, node)
	print("phase 2 starting")
	local s2 = 1
	gui.animate(node, gui.PROP_SCALE, vmath.vector4(s2, s2, s2, 0), gui.EASING_IN, 4, 0)
	--alpha from 1 to 0
	gui.animate(node, gui.PROP_COLOR, 0, gui.EASING_IN, 3, 4)
end

Lua is read top to bottom so if you call animateLogo(self) before animateLogo2 is read it wont work. Try moving animateLogo2(self, node) function above the first one.

2 Likes

Thanks, its working now

1 Like