From ff0e21ff2bc3a7e8478417033070483998aa3b15 Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Sun, 22 Aug 2021 19:15:18 +0200 Subject: [PATCH] * further changes to bg --- scripts/components/background.lua | 97 +++++++++++++++++++++++++++---- scripts/titlescreen.lua | 2 +- 2 files changed, 87 insertions(+), 12 deletions(-) diff --git a/scripts/components/background.lua b/scripts/components/background.lua index 43129dd..6b996c7 100644 --- a/scripts/components/background.lua +++ b/scripts/components/background.lua @@ -13,7 +13,10 @@ local footerY = desh - FOOTER_HEIGHT; 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); +local valkRasisImage = gfx.CreateSkinImage("components/background/rasis_panel.png", 0); +local valkGraceImage = gfx.CreateSkinImage("components/background/grace_panel.png", 0); + +local mainRingImage = gfx.CreateSkinImage("components/background/main_ring.png", 0); -- Animation related local transitionRotateScale = 0; @@ -26,34 +29,106 @@ function resetLayoutInformation() scale = resx / desw end -local drawValkyrie = function (piProgression) +local drawValkyrie = function (spinProgressionScale, valkImage) gfx.Save() gfx.BeginPath() - local distanceScaleMultiplier = (math.sin(piProgression)+math.pi)*0.25 + 0.25 + local w = 1390*0.7; + local h = 3356*0.7 + local piProgression = spinProgressionScale*2*math.pi - 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) + local distanceScaleMultiplier = 0.3 + 0.7*((1+math.sin(piProgression))/2) - gfx.ImageRect(0, 0, 540, 960, valk1Image, 1, 0); + + local xScale = math.sin(piProgression)*distanceScaleMultiplier; + local yScale = 1*distanceScaleMultiplier + + gfx.Translate(math.sin(piProgression+2)*0.6*desw+0.3*desw, (1-distanceScaleMultiplier)*desh*0.4) -- -math.sin(piProgression+2)*0.1*desh+desh*0.1 + -- gfx.Scale(xScale, yScale) + gfx.SkewY( + ( + 1 + + math.sin( + piProgression + + 0.5 * + math.pi + ) + ) / 2 + * -0.3) + --gfx.SkewX(-math.sin(piProgression)*0.2) + + gfx.ImageRect(0, 0, w*xScale, h*yScale, valkImage, 0.5, 0); gfx.Restore() + + + -- ===================== Draw the inner one + gfx.Save() + gfx.BeginPath() + + local w = 1390*0.7; + local h = 3356*0.7 + local piProgression = spinProgressionScale*2*math.pi + + local distanceScaleMultiplier = 0.3 + 0.7*((1+math.sin(piProgression))/2) + + + local xScale = math.sin(piProgression)*distanceScaleMultiplier; + local yScale = 1*distanceScaleMultiplier + + gfx.Translate(math.sin(piProgression+2)*0.57*desw+0.3*desw, (1-distanceScaleMultiplier)*desh*0.4) -- -math.sin(piProgression+2)*0.1*desh+desh*0.1 + -- gfx.Scale(xScale, yScale) + gfx.SkewY( + ( + 1 + + math.sin( + piProgression + + 0.5 * + math.pi + ) + ) / 2 + * -0.3) + --gfx.SkewX(-math.sin(piProgression)*0.2) + + gfx.ImageRect(0, 0, w*xScale, h*yScale, valkImage, 0.5, 0); + gfx.Restore() + end local drawValkyries = function () + gfx.Save() gfx.BeginPath() local piProgression = transitionRotateScale*2*math.pi - drawValkyrie(piProgression) - drawValkyrie(piProgression+math.pi*0.5) - drawValkyrie(piProgression+math.pi*1.0) - drawValkyrie(piProgression+math.pi*1.5) + gfx.Rotate(-0.3) + + drawValkyrie(transitionRotateScale, valkRasisImage) + + drawValkyrie(transitionRotateScale+0.25, valkGraceImage) + drawValkyrie(transitionRotateScale+0.5, valkRasisImage) + drawValkyrie(transitionRotateScale+0.75, valkGraceImage) + gfx.Restore() +end + +local drawRings = function () + gfx.Save() + gfx.BeginPath() + + gfx.SkewX(-0.95) + gfx.Translate(675,225) + + gfx.Rotate(-transitionRotateScale*2*math.pi); + gfx.Translate(-200,-200) + + gfx.ImageRect(0, 0, 400, 400, mainRingImage, 0.5, 0); + gfx.Restore() end local drawBackground = function () gfx.BeginPath(); gfx.ImageRect(0, 0, desw, desh, bgBaseImage, 1, 0); + drawRings(); + drawValkyries(); gfx.BeginPath(); diff --git a/scripts/titlescreen.lua b/scripts/titlescreen.lua index 72d5259..5a66be2 100644 --- a/scripts/titlescreen.lua +++ b/scripts/titlescreen.lua @@ -324,7 +324,7 @@ end render = function(deltaTime) if not playedBgm then - game.PlaySample('titlescreen/bgm.wav', true); + --game.PlaySample('titlescreen/bgm.wav', true); playedBgm = true; end