2022-05-06 00:05:20 +02:00
|
|
|
local Dim = require("common.dimensions")
|
2021-08-12 16:20:19 +02:00
|
|
|
|
2022-05-06 00:05:20 +02:00
|
|
|
local BAR_ALPHA = 191
|
2021-08-12 16:20:19 +02:00
|
|
|
|
|
|
|
local HEADER_HEIGHT = 100
|
|
|
|
|
2022-05-06 00:05:20 +02:00
|
|
|
local animationHeaderGlowScale = 0
|
|
|
|
local animationHeaderGlowAlpha = 0
|
2021-08-12 16:20:19 +02:00
|
|
|
|
|
|
|
-- Images
|
|
|
|
local headerTitleImage = gfx.CreateSkinImage("song_select/header/title.png", 1)
|
|
|
|
local headerGlowTitleImage = gfx.CreateSkinImage("song_select/header/title_glow.png", 1)
|
|
|
|
|
2022-05-06 00:05:20 +02:00
|
|
|
local drawHeader = function()
|
|
|
|
gfx.BeginPath()
|
|
|
|
gfx.FillColor(0, 0, 0, BAR_ALPHA)
|
|
|
|
gfx.Rect(0, 0, Dim.design.width, HEADER_HEIGHT)
|
|
|
|
gfx.Fill()
|
2021-08-12 16:20:19 +02:00
|
|
|
gfx.ClosePath()
|
|
|
|
|
2022-05-06 00:05:20 +02:00
|
|
|
gfx.ImageRect(42, 14, 423 * 0.85, 80 * 0.85, headerTitleImage, 1, 0)
|
|
|
|
gfx.ImageRect(42, 14, 423 * 0.85, 80 * 0.85, headerGlowTitleImage, animationHeaderGlowAlpha, 0)
|
2021-08-12 16:20:19 +02:00
|
|
|
end
|
|
|
|
|
2022-05-06 00:05:20 +02:00
|
|
|
local progressTransitions = function(deltatime)
|
2021-08-12 16:20:19 +02:00
|
|
|
-- HEADER GLOW ANIMATION
|
|
|
|
if animationHeaderGlowScale < 1 then
|
|
|
|
animationHeaderGlowScale = animationHeaderGlowScale + deltatime / 1 -- transition should last for that time in seconds
|
|
|
|
else
|
|
|
|
animationHeaderGlowScale = 0
|
|
|
|
end
|
|
|
|
|
|
|
|
if animationHeaderGlowScale < 0.5 then
|
2022-05-06 00:05:20 +02:00
|
|
|
animationHeaderGlowAlpha = animationHeaderGlowScale * 2
|
2021-08-12 16:20:19 +02:00
|
|
|
else
|
2022-05-06 00:05:20 +02:00
|
|
|
animationHeaderGlowAlpha = 1 - ((animationHeaderGlowScale - 0.5) * 2)
|
2021-08-12 16:20:19 +02:00
|
|
|
end
|
2022-05-06 00:05:20 +02:00
|
|
|
animationHeaderGlowAlpha = animationHeaderGlowAlpha * 0.4
|
2021-08-12 16:20:19 +02:00
|
|
|
end
|
|
|
|
|
2022-05-06 00:05:20 +02:00
|
|
|
local draw = function(deltatime)
|
2021-08-12 16:20:19 +02:00
|
|
|
gfx.Save()
|
|
|
|
|
2022-05-06 00:05:20 +02:00
|
|
|
gfx.ResetTransform()
|
|
|
|
|
|
|
|
Dim.updateResolution()
|
|
|
|
|
|
|
|
Dim.transformToScreenSpace()
|
|
|
|
|
|
|
|
gfx.LoadSkinFont("NotoSans-Regular.ttf")
|
|
|
|
|
|
|
|
drawHeader()
|
|
|
|
|
|
|
|
progressTransitions(deltatime)
|
2021-08-12 16:20:19 +02:00
|
|
|
|
|
|
|
gfx.Restore()
|
|
|
|
end
|
|
|
|
|
2022-05-06 00:05:20 +02:00
|
|
|
return {draw = draw}
|