+ jacket background & + some transitions to songwheel
This commit is contained in:
parent
2d098d9b74
commit
38f31bd5a3
|
@ -93,7 +93,10 @@ local transitionAfterscrollScale = 0;
|
||||||
local transitionAfterscrollDataOverlayAlpha = 0;
|
local transitionAfterscrollDataOverlayAlpha = 0;
|
||||||
local transitionAfterscrollGradeAlpha = 0;
|
local transitionAfterscrollGradeAlpha = 0;
|
||||||
local transitionAfterscrollBadgeAlpha = 0;
|
local transitionAfterscrollBadgeAlpha = 0;
|
||||||
|
local transitionAfterscrollTextSongTitle = 0;
|
||||||
|
local transitionAfterscrollTextSongArtist = 0;
|
||||||
local transitionAfterscrollDifficultiesAlpha = 0;
|
local transitionAfterscrollDifficultiesAlpha = 0;
|
||||||
|
local transitionAfterscrollJacketBgAlpha = 0;
|
||||||
|
|
||||||
function resetLayoutInformation()
|
function resetLayoutInformation()
|
||||||
resx, resy = game.GetResolution()
|
resx, resy = game.GetResolution()
|
||||||
|
@ -150,7 +153,7 @@ end;
|
||||||
|
|
||||||
function getJacketImage(song)
|
function getJacketImage(song)
|
||||||
if not jacketCache[song.id] or jacketCache[song.id]==defaultJacketImage then
|
if not jacketCache[song.id] or jacketCache[song.id]==defaultJacketImage then
|
||||||
jacketCache[song.id] = gfx.LoadImageJob(song.difficulties[1].jacketPath, defaultJacketImage, 400, 400);
|
jacketCache[song.id] = gfx.LoadImageJob(song.difficulties[1].jacketPath, defaultJacketImage, 0, 0);
|
||||||
end
|
end
|
||||||
|
|
||||||
return jacketCache[song.id];
|
return jacketCache[song.id];
|
||||||
|
@ -180,6 +183,19 @@ function drawBackground()
|
||||||
local diff = song.difficulties[selectedDifficulty];
|
local diff = song.difficulties[selectedDifficulty];
|
||||||
local bestScore = diff.scores[1];
|
local bestScore = diff.scores[1];
|
||||||
if song and diff and bestScore then
|
if song and diff and bestScore then
|
||||||
|
local jacketImage = getJacketImage(song);
|
||||||
|
if jacketImage ~= defaultJacketImage then
|
||||||
|
gfx.BeginPath()
|
||||||
|
gfx.ImageRect(0+transitionAfterscrollScale*-300, 0, 900, 900, jacketImage or defaultJacketImage, transitionAfterscrollJacketBgAlpha, 0)
|
||||||
|
|
||||||
|
|
||||||
|
gfx.BeginPath();
|
||||||
|
gfx.FillColor(0,0,0,math.floor(transitionAfterscrollJacketBgAlpha*64));
|
||||||
|
gfx.Rect(0,0,900,900);
|
||||||
|
gfx.Fill();
|
||||||
|
gfx.ClosePath();
|
||||||
|
end
|
||||||
|
|
||||||
gfx.BeginPath()
|
gfx.BeginPath()
|
||||||
gfx.ImageRect(0, 0, desw, desh, dataBackgroundOverlayImage, transitionAfterscrollDataOverlayAlpha, 0)
|
gfx.ImageRect(0, 0, desw, desh, dataBackgroundOverlayImage, transitionAfterscrollDataOverlayAlpha, 0)
|
||||||
end
|
end
|
||||||
|
@ -311,15 +327,20 @@ function drawData() -- Draws the song data on the left panel
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
||||||
gfx.Save()
|
gfx.Save()
|
||||||
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
|
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
|
||||||
|
gfx.GlobalAlpha(transitionAfterscrollDataOverlayAlpha) -- TODO: split this out
|
||||||
gfx.Text(song.bpm, 85, 920);
|
gfx.Text(song.bpm, 85, 920);
|
||||||
gfx.Restore()
|
gfx.Restore()
|
||||||
|
|
||||||
-- Draw song title
|
-- Draw song title
|
||||||
gfx.FontSize(28)
|
gfx.FontSize(28)
|
||||||
gfx.Text(song.title, 30, 955);
|
gfx.GlobalAlpha(transitionAfterscrollTextSongTitle);
|
||||||
|
gfx.Text(song.title, 30+(1-transitionAfterscrollTextSongTitle)*20, 955);
|
||||||
|
|
||||||
-- Draw artist
|
-- Draw artist
|
||||||
gfx.Text(song.artist, 30, 997);
|
gfx.GlobalAlpha(transitionAfterscrollTextSongArtist);
|
||||||
|
gfx.Text(song.artist, 30+(1-transitionAfterscrollTextSongArtist)*20, 997);
|
||||||
|
|
||||||
|
gfx.GlobalAlpha(1);
|
||||||
|
|
||||||
-- Draw difficulties
|
-- Draw difficulties
|
||||||
local DIFF_X_START = 98.5
|
local DIFF_X_START = 98.5
|
||||||
|
@ -354,7 +375,7 @@ function tickTransitions(deltaTime)
|
||||||
if transitionAfterscrollScale < 1 then
|
if transitionAfterscrollScale < 1 then
|
||||||
if transitionScrollScale == 1 then
|
if transitionScrollScale == 1 then
|
||||||
-- Only start the after scroll transition when the scroll transition is finished
|
-- Only start the after scroll transition when the scroll transition is finished
|
||||||
transitionAfterscrollScale = transitionAfterscrollScale + deltaTime / 0.5
|
transitionAfterscrollScale = transitionAfterscrollScale + deltaTime / 15
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
transitionAfterscrollScale = 1;
|
transitionAfterscrollScale = 1;
|
||||||
|
@ -366,36 +387,60 @@ function tickTransitions(deltaTime)
|
||||||
transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * -songPlateHeight;
|
transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * -songPlateHeight;
|
||||||
end
|
end
|
||||||
|
|
||||||
if transitionAfterscrollScale < 0.5 then
|
if transitionAfterscrollScale < 0.02 then
|
||||||
transitionAfterscrollDataOverlayAlpha = math.min(1, transitionAfterscrollScale / 0.5)
|
transitionAfterscrollDataOverlayAlpha = math.min(1, transitionAfterscrollScale / 0.02)
|
||||||
else
|
else
|
||||||
transitionAfterscrollDataOverlayAlpha = 1;
|
transitionAfterscrollDataOverlayAlpha = 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Grade alpha
|
-- Grade alpha
|
||||||
if transitionAfterscrollScale >= 0.7 and transitionAfterscrollScale < 0.8 then
|
if transitionAfterscrollScale >= 0.03 and transitionAfterscrollScale < 0.033 then
|
||||||
transitionAfterscrollGradeAlpha = 0.5;
|
transitionAfterscrollGradeAlpha = 0.5;
|
||||||
elseif transitionAfterscrollScale >= 0.95 then
|
elseif transitionAfterscrollScale >= 0.04 then
|
||||||
transitionAfterscrollGradeAlpha = 1;
|
transitionAfterscrollGradeAlpha = 1;
|
||||||
else
|
else
|
||||||
transitionAfterscrollGradeAlpha = 0;
|
transitionAfterscrollGradeAlpha = 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Badge alpha
|
-- Badge alpha
|
||||||
if transitionAfterscrollScale >= 0.75 and transitionAfterscrollScale < 0.85 then
|
if transitionAfterscrollScale >= 0.032 and transitionAfterscrollScale < 0.035 then
|
||||||
transitionAfterscrollBadgeAlpha = 0.5;
|
transitionAfterscrollBadgeAlpha = 0.5;
|
||||||
elseif transitionAfterscrollScale >= 1 then
|
elseif transitionAfterscrollScale >= 0.042 then
|
||||||
transitionAfterscrollBadgeAlpha = 1;
|
transitionAfterscrollBadgeAlpha = 1;
|
||||||
else
|
else
|
||||||
transitionAfterscrollBadgeAlpha = 0;
|
transitionAfterscrollBadgeAlpha = 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Song title alpha and pos
|
||||||
|
if transitionAfterscrollScale < 0.02 then
|
||||||
|
transitionAfterscrollTextSongTitle = Easing.outQuad(math.min(1, (transitionAfterscrollScale) / 0.02));
|
||||||
|
else
|
||||||
|
transitionAfterscrollTextSongTitle = 1
|
||||||
|
end
|
||||||
|
-- Song artist alpha and pos
|
||||||
|
if transitionAfterscrollScale < 0.03 then
|
||||||
|
transitionAfterscrollTextSongArtist = Easing.outQuad(math.min(1, (transitionAfterscrollScale) / 0.03));
|
||||||
|
else
|
||||||
|
transitionAfterscrollTextSongArtist = 1
|
||||||
|
end
|
||||||
|
|
||||||
-- Difficulties alpha
|
-- Difficulties alpha
|
||||||
if transitionAfterscrollScale < 0.25 then
|
if transitionAfterscrollScale < 0.025 then
|
||||||
transitionAfterscrollDifficultiesAlpha = math.min(1, transitionAfterscrollScale / 0.25)
|
transitionAfterscrollDifficultiesAlpha = math.min(1, transitionAfterscrollScale / 0.025)
|
||||||
else
|
else
|
||||||
transitionAfterscrollDifficultiesAlpha = 1;
|
transitionAfterscrollDifficultiesAlpha = 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Jacket background alpha
|
||||||
|
if transitionAfterscrollScale < 0.05 or transitionAfterscrollScale >= 1 then
|
||||||
|
transitionAfterscrollJacketBgAlpha = 0;
|
||||||
|
elseif transitionAfterscrollScale >= 0.05 and transitionAfterscrollScale < 0.1 then
|
||||||
|
transitionAfterscrollJacketBgAlpha = math.min(1, (transitionAfterscrollScale-0.05) / 0.05);
|
||||||
|
elseif transitionAfterscrollScale >= 0.95 and transitionAfterscrollScale < 1 then
|
||||||
|
transitionAfterscrollJacketBgAlpha = math.min(1, 1-((transitionAfterscrollScale-0.95) / 0.05));
|
||||||
|
else
|
||||||
|
transitionAfterscrollJacketBgAlpha = 1;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue