/ fix stutters in transition animations & + add fade in transition after the idol animation is loaded
This commit is contained in:
parent
2ba19074b4
commit
535ec4f369
|
@ -39,6 +39,8 @@ local selectorLegendSelectLabel = gfx.CreateLabel('START', 20, 0);
|
||||||
local scrollTransitionScale = 1; -- Goes from 0 to 1 when transition is happening, sits at 1 when it's not.
|
local scrollTransitionScale = 1; -- Goes from 0 to 1 when transition is happening, sits at 1 when it's not.
|
||||||
local buttonsMovementScale = 0; -- Basically same as `scrollTransitionScale` but with a +/- sign for the scroll direction and goes from 1 to 0
|
local buttonsMovementScale = 0; -- Basically same as `scrollTransitionScale` but with a +/- sign for the scroll direction and goes from 1 to 0
|
||||||
|
|
||||||
|
local idolAnimTransitionScale = 0;
|
||||||
|
|
||||||
local oldCursorIndex = 3;
|
local oldCursorIndex = 3;
|
||||||
local scrollingUp = false;
|
local scrollingUp = false;
|
||||||
local playedBgm = false;
|
local playedBgm = false;
|
||||||
|
@ -240,8 +242,18 @@ render = function(deltaTime)
|
||||||
-- Draw background
|
-- Draw background
|
||||||
gfx.ImageRect(0, 0, resx, resy, bgImage, 1, 0);
|
gfx.ImageRect(0, 0, resx, resy, bgImage, 1, 0);
|
||||||
|
|
||||||
gfx.ImageRect(0, 0, resx, resy, idolAnimation, 1, 0);
|
local idolAnimTickRes = gfx.TickAnimation(idolAnimation, deltaTime);
|
||||||
gfx.TickAnimation(idolAnimation, deltaTime);
|
if idolAnimTickRes == 1 then
|
||||||
|
gfx.GlobalAlpha(idolAnimTransitionScale);
|
||||||
|
|
||||||
|
idolAnimTransitionScale = idolAnimTransitionScale + 1/60;
|
||||||
|
if (idolAnimTransitionScale > 1) then
|
||||||
|
idolAnimTransitionScale = 1;
|
||||||
|
end
|
||||||
|
|
||||||
|
gfx.ImageRect(0, 0, resx, resy, idolAnimation, 1, 0);
|
||||||
|
gfx.GlobalAlpha(1);
|
||||||
|
end
|
||||||
|
|
||||||
-- Draw selector background
|
-- Draw selector background
|
||||||
gfx.ImageRect(0, (resy/2) - 280/2, 1079, 280, selectorBgImage, 1, 0);
|
gfx.ImageRect(0, (resy/2) - 280/2, 1079, 280, selectorBgImage, 1, 0);
|
||||||
|
|
|
@ -23,44 +23,42 @@ function render(deltaTime)
|
||||||
loadAnimations()
|
loadAnimations()
|
||||||
end
|
end
|
||||||
|
|
||||||
if not wasEnterSfxPlayed then
|
local enterAnimTickRes = gfx.TickAnimation(transitionEnterAnimation, deltaTime);
|
||||||
game.PlaySample('transition_screen/transition_enter.wav');
|
|
||||||
wasEnterSfxPlayed = true;
|
|
||||||
end
|
|
||||||
|
|
||||||
BREAKPOINT_INVISIBLE = 0.27;
|
|
||||||
BREAKPOINT_VISIBLE = BREAKPOINT_INVISIBLE + 0.05;
|
|
||||||
|
|
||||||
|
|
||||||
if timer < BREAKPOINT_INVISIBLE then
|
if enterAnimTickRes == 0 then
|
||||||
gfx.GlobalAlpha(0);
|
gfx.GlobalAlpha(0);
|
||||||
elseif (timer >= BREAKPOINT_INVISIBLE and timer < BREAKPOINT_VISIBLE) then
|
|
||||||
gfx.GlobalAlpha((timer-BREAKPOINT_INVISIBLE) * (1/(BREAKPOINT_VISIBLE-BREAKPOINT_INVISIBLE)));
|
|
||||||
else
|
else
|
||||||
|
if not wasEnterSfxPlayed then
|
||||||
|
game.PlaySample('transition_screen/transition_enter.wav');
|
||||||
|
wasEnterSfxPlayed = true;
|
||||||
|
end
|
||||||
|
gfx.ImageRect(0, 0, resx, resy, transitionEnterAnimation, 1, 0);
|
||||||
gfx.GlobalAlpha(1);
|
gfx.GlobalAlpha(1);
|
||||||
|
|
||||||
|
-- debug
|
||||||
|
-- gfx.Text('DELTA: ' .. deltaTime .. ' // TIMER: ' .. timer .. ' // TIMER_OUT: ' .. outTimer, 255,255);
|
||||||
|
timer = timer + (deltaTime / 3);
|
||||||
end
|
end
|
||||||
|
|
||||||
gfx.ImageRect(0, 0, resx, resy, transitionEnterAnimation, 1, 0);
|
|
||||||
gfx.TickAnimation(transitionEnterAnimation, deltaTime);
|
|
||||||
gfx.GlobalAlpha(1);
|
|
||||||
|
|
||||||
-- debug
|
|
||||||
-- gfx.Text('DELTA: ' .. deltaTime .. ' // TIMER: ' .. timer .. ' // TIMER_OUT: ' .. outTimer, 255,255);
|
|
||||||
timer = timer + (deltaTime / 3);
|
|
||||||
|
|
||||||
if timer >= 1 then return true end;
|
if timer >= 1 then return true end;
|
||||||
end
|
end
|
||||||
|
|
||||||
function render_out(deltaTime)
|
function render_out(deltaTime)
|
||||||
if not wasLeaveSfxPlayed then
|
local leaveAnimeTickRes = gfx.TickAnimation(transitionLeaveAnimation, deltaTime);
|
||||||
game.PlaySample('transition_screen/transition_leave.wav');
|
|
||||||
wasLeaveSfxPlayed = true;
|
if leaveAnimeTickRes == 0 then
|
||||||
|
gfx.ImageRect(0, 0, resx, resy, transitionEnterAnimation, 1, 0);
|
||||||
|
else
|
||||||
|
if not wasLeaveSfxPlayed then
|
||||||
|
game.PlaySample('transition_screen/transition_leave.wav');
|
||||||
|
wasLeaveSfxPlayed = true;
|
||||||
|
end
|
||||||
|
|
||||||
|
gfx.ImageRect(0, 0, resx, resy, transitionLeaveAnimation, 1, 0);
|
||||||
|
outTimer = outTimer + (1/60) / 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
gfx.ImageRect(0, 0, resx, resy, transitionLeaveAnimation, 1, 0);
|
|
||||||
gfx.TickAnimation(transitionLeaveAnimation, deltaTime);
|
|
||||||
|
|
||||||
outTimer = outTimer + (1/60) / 0.5
|
|
||||||
|
|
||||||
if outTimer >= 1 then
|
if outTimer >= 1 then
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue