83 lines
2.0 KiB
Lua
83 lines
2.0 KiB
Lua
|
|
|
|
local resx, resy = game.GetResolution()
|
|
local desw, desh = 1080,1920;
|
|
local scale = 1;
|
|
|
|
local BAR_ALPHA = 191;
|
|
|
|
local FOOTER_HEIGHT = 128
|
|
local footerY = desh - FOOTER_HEIGHT;
|
|
|
|
-- Images
|
|
local bgBaseImage = gfx.CreateSkinImage("components/background/bg.png", 0);
|
|
local dotsOverlayImage = gfx.CreateSkinImage("components/background/dots.png", 0);
|
|
|
|
local valk1Image = gfx.CreateSkinImage("components/background/test.png", 0);
|
|
|
|
-- Animation related
|
|
local transitionRotateScale = 0;
|
|
|
|
|
|
function resetLayoutInformation()
|
|
resx, resy = game.GetResolution()
|
|
desw = 1080
|
|
desh = 1920
|
|
scale = resx / desw
|
|
end
|
|
|
|
local drawValkyrie = function (piProgression)
|
|
gfx.Save()
|
|
gfx.BeginPath()
|
|
|
|
local distanceScaleMultiplier = (math.sin(piProgression)+math.pi)*0.25 + 0.25
|
|
|
|
gfx.Translate(math.sin(piProgression+2)*0.6*desw+0.5*desw,-math.sin(piProgression+2)*0.1*desh+desh*0.1)
|
|
gfx.Scale(math.sin(piProgression)*distanceScaleMultiplier, 1*distanceScaleMultiplier)
|
|
gfx.SkewY(-math.sin(piProgression+0.5*math.pi)*0.3)
|
|
|
|
gfx.ImageRect(0, 0, 540, 960, valk1Image, 1, 0);
|
|
gfx.Restore()
|
|
end
|
|
|
|
local drawValkyries = function ()
|
|
gfx.BeginPath()
|
|
|
|
local piProgression = 1-transitionRotateScale*2*math.pi
|
|
drawValkyrie(piProgression)
|
|
drawValkyrie(piProgression+math.pi*0.5)
|
|
drawValkyrie(piProgression+math.pi*1.0)
|
|
drawValkyrie(piProgression+math.pi*1.5)
|
|
end
|
|
|
|
local drawBackground = function ()
|
|
gfx.BeginPath();
|
|
gfx.ImageRect(0, 0, desw, desh, bgBaseImage, 1, 0);
|
|
|
|
drawValkyries();
|
|
|
|
gfx.BeginPath();
|
|
gfx.ImageRect(0, 0, desw, desh, dotsOverlayImage, 1, 0);
|
|
end
|
|
|
|
local progressTransitions = function (deltaTime)
|
|
transitionRotateScale = transitionRotateScale + deltaTime / 10;
|
|
if (transitionRotateScale > 1) then
|
|
transitionRotateScale = 0;
|
|
end
|
|
end
|
|
|
|
local draw = function (deltaTime)
|
|
gfx.Save()
|
|
resetLayoutInformation()
|
|
gfx.Scale(scale, scale)
|
|
|
|
drawBackground();
|
|
|
|
progressTransitions(deltaTime);
|
|
gfx.Restore()
|
|
end
|
|
|
|
return {
|
|
draw = draw
|
|
}; |