+ after scroll animation timing and some effects that use it
This commit is contained in:
parent
8ffc12f82a
commit
c2619a2af0
|
@ -77,6 +77,11 @@ local transitionScrollScale = 0;
|
||||||
local transitionScrollOffsetY = 0;
|
local transitionScrollOffsetY = 0;
|
||||||
local scrollingUp = false;
|
local scrollingUp = false;
|
||||||
|
|
||||||
|
local transitionAfterscrollScale = 0;
|
||||||
|
local transitionAfterscrollDataOverlayAlpha = 0;
|
||||||
|
local transitionAfterscrollGradeAlpha = 0;
|
||||||
|
local transitionAfterscrollBadgeAlpha = 0;
|
||||||
|
|
||||||
function resetLayoutInformation()
|
function resetLayoutInformation()
|
||||||
resx, resy = game.GetResolution()
|
resx, resy = game.GetResolution()
|
||||||
desw = 1080
|
desw = 1080
|
||||||
|
@ -163,7 +168,7 @@ function drawBackground()
|
||||||
local bestScore = diff.scores[1];
|
local bestScore = diff.scores[1];
|
||||||
if song and diff and bestScore then
|
if song and diff and bestScore then
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.ImageRect(0, 0, desw, desh, dataBackgroundOverlayImage, 1, 0)
|
gfx.ImageRect(0, 0, desw, desh, dataBackgroundOverlayImage, transitionAfterscrollDataOverlayAlpha, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -264,6 +269,7 @@ function drawData() -- Draws the song data on the left panel
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.ImageRect(96, 324, 348, 348, jacketImage or defaultJacketImage, 1, 0)
|
gfx.ImageRect(96, 324, 348, 348, jacketImage or defaultJacketImage, 1, 0)
|
||||||
|
|
||||||
|
gfx.Save()
|
||||||
if bestScore then
|
if bestScore then
|
||||||
-- Draw best score
|
-- Draw best score
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
|
@ -277,15 +283,17 @@ function drawData() -- Draws the song data on the left panel
|
||||||
end
|
end
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(360, 773, 45, 45, gradeImage, 1, 0);
|
gfx.ImageRect(360, 773, 45, 45, gradeImage, transitionAfterscrollGradeAlpha, 0);
|
||||||
|
|
||||||
-- Draw badge
|
-- Draw badge
|
||||||
badgeImage = badgeImages[bestScore.badge+1];
|
badgeImage = badgeImages[bestScore.badge+1];
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.ImageRect(425, 724, 93/1.1, 81/1.1, badgeImage, 1, 0)
|
gfx.ImageRect(425, 724, 93/1.1, 81/1.1, badgeImage, transitionAfterscrollBadgeAlpha, 0)
|
||||||
end
|
end
|
||||||
|
gfx.Restore()
|
||||||
|
|
||||||
-- Draw BPM
|
-- Draw BPM
|
||||||
|
gfx.BeginPath();
|
||||||
gfx.FontSize(24)
|
gfx.FontSize(24)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
||||||
gfx.Save()
|
gfx.Save()
|
||||||
|
@ -308,11 +316,45 @@ function tickTransitions(deltaTime)
|
||||||
transitionScrollScale = 1
|
transitionScrollScale = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if transitionAfterscrollScale < 1 then
|
||||||
|
if transitionScrollScale == 1 then
|
||||||
|
-- Only start the after scroll transition when the scroll transition is finished
|
||||||
|
transitionAfterscrollScale = transitionAfterscrollScale + deltaTime / 0.5
|
||||||
|
end
|
||||||
|
else
|
||||||
|
transitionAfterscrollScale = 1;
|
||||||
|
end
|
||||||
|
|
||||||
if scrollingUp then
|
if scrollingUp then
|
||||||
transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * songPlateHeight;
|
transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * songPlateHeight;
|
||||||
else
|
else
|
||||||
transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * -songPlateHeight;
|
transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * -songPlateHeight;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if transitionAfterscrollScale < 0.5 then
|
||||||
|
transitionAfterscrollDataOverlayAlpha = math.min(1, transitionAfterscrollScale / 0.5)
|
||||||
|
else
|
||||||
|
transitionAfterscrollDataOverlayAlpha = 1;
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Grade alpha
|
||||||
|
if transitionAfterscrollScale >= 0.7 and transitionAfterscrollScale < 0.8 then
|
||||||
|
transitionAfterscrollGradeAlpha = 0.5;
|
||||||
|
elseif transitionAfterscrollScale >= 0.95 then
|
||||||
|
transitionAfterscrollGradeAlpha = 1;
|
||||||
|
else
|
||||||
|
transitionAfterscrollGradeAlpha = 0;
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Badge alpha
|
||||||
|
if transitionAfterscrollScale >= 0.75 and transitionAfterscrollScale < 0.85 then
|
||||||
|
transitionAfterscrollBadgeAlpha = 0.5;
|
||||||
|
elseif transitionAfterscrollScale >= 1 then
|
||||||
|
transitionAfterscrollBadgeAlpha = 1;
|
||||||
|
else
|
||||||
|
transitionAfterscrollBadgeAlpha = 0;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,11 +380,12 @@ render = function (deltaTime)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
|
||||||
local debugScrollingUp= "FALSE"
|
local debugScrollingUp= "FALSE"
|
||||||
if scrollingUp then debugScrollingUp = "TRUE" end;
|
if scrollingUp then debugScrollingUp = "TRUE" end;
|
||||||
gfx.Text('DELTA: ' .. deltaTime .. ' // SELECTED_INDEX: ' .. selectedIndex .. ' // SELECTED_DIFF: ' .. selectedDifficulty .. ' // SCROLLING_UP: ' .. debugScrollingUp, 8, 8);
|
gfx.Text('DELTA: ' .. deltaTime .. ' // SELECTED_INDEX: ' .. selectedIndex .. ' // SELECTED_DIFF: ' .. selectedDifficulty .. ' // SCROLLING_UP: ' .. debugScrollingUp .. ' // AC_TS: ' .. transitionAfterscrollScale, 8, 8);
|
||||||
end
|
end
|
||||||
|
|
||||||
set_index = function(newIndex)
|
set_index = function(newIndex)
|
||||||
transitionScrollScale = 0;
|
transitionScrollScale = 0;
|
||||||
|
transitionAfterscrollScale = 0;
|
||||||
|
|
||||||
scrollingUp = false;
|
scrollingUp = false;
|
||||||
if ((newIndex > selectedIndex and not (newIndex == #songwheel.songs and selectedIndex == 1)) or (newIndex == 1 and selectedIndex == #songwheel.songs)) then
|
if ((newIndex > selectedIndex and not (newIndex == #songwheel.songs and selectedIndex == 1)) or (newIndex == 1 and selectedIndex == #songwheel.songs)) then
|
||||||
|
|
Loading…
Reference in New Issue