Hi there,
I made a splash screen based on this example: Splash
Since I load a large model, it can take some time before the game starts, so I added a spinner to indicate the app is running, based on this example: Spinner animation
My test spinner stops before the splash screen is fully unloaded:
Would it be possible to make it spin longer, ideally until the splash screen is fully unloaded?
This is my code for the loader.script:
function init(self)
msg.post(".", "acquire_input_focus")
msg.post("#splashproxy", "async_load")
end
function on_message(self, message_id, message, sender)
if message_id == hash("proxy_loaded") then
if sender.fragment == hash("splashproxy") then
msg.post("#splashproxy", "enable")
msg.post("#gameproxy", "async_load")
self.game_loading_started_time = os.time()
elseif sender.fragment == hash("gameproxy") then
local total_game_loading_time = os.time() - self.game_loading_started_time
local minimum_splash_duration = 3
-- local minimum_splash_duration = 0
local delay = math.max(minimum_splash_duration - total_game_loading_time, 0)
timer.delay(delay, false, function()
msg.post("#splashproxy", "unload")
msg.post("#gameproxy", "enable")
end)
end
end
end
And this for the splash.gui_script:
local spinner
local t
local speed
function init(self)
spinner = gui.get_node("spinner")
t = 0
speed = 16
end
function update(self, dt)
t = t + dt
local step = math.floor(t * speed)
local angle = math.pi / 6 * step
local rot = vmath.quat_rotation_z(-angle)
gui.set_rotation(spinner,rot)
end
If someone could help me with this, I’d be very grateful.