Search code examples
luacoronasdkcorona-storyboard

Corona/Lua: Screen transitions don't work


I am having problems getting screen transition effects to work. I've tried the supported fade and crossFade effects, but when the transition happens, it's immediate and with no fading effect at all. Everything else works just fine and I get no errors. What am I doing wrong?

local storyboard = require ("storyboard")
local scene = storyboard.newScene()

local loading = require ("loading")
local loading = loading.new()

function switch()
    storyboard.gotoScene("scene1","fade", 700)
end

function scene:enterScene( event )
    timer.performWithDelay(2000,switch,1)
end
scene:addEventListener( "enterScene", scene )

return scene

I have also tried

function switch()
    storyboard.gotoScene("scene1",{effect="fade", time=700})
end

and

local options = {effect="fade", time=700}

function switch()
    storyboard.gotoScene("scene1", options)
end

Solution

  • One common mistake is that you forget to add your view elements to the self.view group. Often, storyboard templates includes local group = self.view at the beginning of the scene:createScene function. Try to insert your view objects into that group. Then retry your transitions.