I've been using scene manager to fade scenes in and out.
The problem I found is that if you have different layers of images, you'll get an odd effect where you can see the edges of the graphics.
One thing that seems to work well is creating a black shape and then fading the black shape out (at the start of the scene) then in (at the end of the scene).
Here's the code:
To fade in a scene:
-- Add black overlay
local blackOverlay = Shape.new()
blackOverlay:setFillStyle(Shape.SOLID, 0x000000)
blackOverlay:beginPath()
blackOverlay:lineTo(0, 480)
blackOverlay:lineTo(320, 480)
blackOverlay:lineTo(320, 0)
blackOverlay:lineTo(0, 0)
blackOverlay:endPath()
self:addChild(blackOverlay)
-- Now fade it out
local tween = GTween.new(blackOverlay, .4, {alpha=0}) |
To fade out the scene:
local tween = GTween.new(blackOverlay, .6, {alpha=1}) |
Tested on device and it looks sexy! B-)
Comments
try to use derived values instead of absolute ones like 320, 480.
Instead if you use
Likes: duke2017
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps