我在 Corona 中使用了一行简单的代码在场景之间转换——转换发生了,但效果没有。
storyboard.gotoScene( "splash", "fade", 2000 )
我已经为 Xcode 模拟器编译了构建,以查看淡入淡出效果是否可以在那里工作,而事实并非如此。
完整代码 -
local storyboard = require "storyboard"
local scene = storyboard.newScene()
local SplashGroup = display.newGroup()
local function onBackgroundTouch()
storyboard.gotoScene("mainmenu", "fade", 2000)
end
--Called if the scene hasn't been previously seen
function scene:createScene (event)
local logoImage = display.newImage("RoxisLogo.png")
logoImage.x = display.contentWidth/2
logoImage.x = display.contentHeight/2
SplashGroup:insert(logoImage)
logoImage:addEventListener("tap", onBackgroundTouch)
end
function scene:enterScene(event)
SplashGroup.alpha=1
end
function scene:exitScene(event)
SplashGroup.alpha=0
end
--"createScene" is called whenever the scene is FIRST called
scene:addEventListener("createScene", scene)
--"enterScene event is dispatched whenever scene transition has finished
scene:addEventListener("enterScene", scene)
--"exitScene" event is dispatched before the next scene's transition begins
scene:addEventListener("exitScene", scene)
return scene