2021-10-28 13:46:24 +02:00
|
|
|
local Easing = require('common.easings')
|
2021-10-28 12:17:20 +02:00
|
|
|
|
|
|
|
local bgImage = gfx.CreateSkinImage("gameplay/track_end/bg.png", 0)
|
|
|
|
local bgHexTopImage = gfx.CreateSkinImage("gameplay/track_end/top_hex.png", 0)
|
|
|
|
local bgHexBottomImage = gfx.CreateSkinImage("gameplay/track_end/bottom_hex.png", 0)
|
|
|
|
|
|
|
|
local enterFlareBlueImage = gfx.CreateSkinImage("gameplay/track_end/flares/blue_transition_flare.png", 0)
|
|
|
|
local enterFlarePinkImage = gfx.CreateSkinImage("gameplay/track_end/flares/pink_transition_flare.png", 0)
|
|
|
|
|
2021-10-28 13:13:34 +02:00
|
|
|
local trackCompImage = gfx.CreateSkinImage("gameplay/track_end/track_comp.png", 0)
|
2021-10-28 15:16:55 +02:00
|
|
|
local trackCompBlurImage = gfx.CreateSkinImage("gameplay/track_end/track_comp_blur.png", 0)
|
2021-10-28 13:13:34 +02:00
|
|
|
|
2021-10-28 13:46:24 +02:00
|
|
|
local particleRedBall = gfx.CreateSkinImage("gameplay/track_end/particles/red_ball.png", 0)
|
|
|
|
local particleRedRing = gfx.CreateSkinImage("gameplay/track_end/particles/red_ring.png", 0)
|
2021-10-28 14:54:31 +02:00
|
|
|
local particleYellowRing = gfx.CreateSkinImage("gameplay/track_end/particles/yellow_ring.png", 0)
|
|
|
|
|
|
|
|
local particleSmallRainbowRing = gfx.CreateSkinImage("gameplay/track_end/particles/small_rainbow_ring.png", 0)
|
|
|
|
local particleSmYellowRingA = gfx.CreateSkinImage("gameplay/track_end/particles/small_yellow_ring_1.png", 0)
|
|
|
|
local particleSmYellowRingB = gfx.CreateSkinImage("gameplay/track_end/particles/small_yellow_ring_2.png", 0)
|
|
|
|
local particleSmYellowRingC = gfx.CreateSkinImage("gameplay/track_end/particles/small_yellow_ring_4.png", 0)
|
|
|
|
|
2021-10-28 13:46:24 +02:00
|
|
|
|
2021-10-28 12:17:20 +02:00
|
|
|
local outroTransitionScale = 0;
|
|
|
|
local outroTransitionGlobalAlpha = 0;
|
|
|
|
local outroTransitionEnterFlareX = -1920;
|
2021-10-28 14:54:31 +02:00
|
|
|
|
2021-10-28 13:13:34 +02:00
|
|
|
local outroTransitionTextCutX = 0;
|
2021-10-28 15:16:55 +02:00
|
|
|
local outroTransitionTextAlpha = 1;
|
|
|
|
local outroTransitionTextBlurAlpha = 0;
|
2021-10-28 14:54:31 +02:00
|
|
|
|
|
|
|
local outroTransitionParticleRedX = -500;
|
|
|
|
|
|
|
|
local outroTransitionParticleSmallRainbowX = 1080;
|
|
|
|
local outroTransitionParticleSmallYellowRingAX = 1080;
|
|
|
|
local outroTransitionParticleSmallYellowRingBX = 1080;
|
|
|
|
local outroTransitionParticleSmallYellowRingCX = 1080;
|
2021-10-28 12:17:20 +02:00
|
|
|
|
|
|
|
local tickTransitions = function (deltaTime)
|
|
|
|
if outroTransitionScale < 1 then
|
2021-10-28 17:02:24 +02:00
|
|
|
outroTransitionScale = outroTransitionScale + deltaTime / 3 -- transition should last for that time in seconds
|
2021-10-28 12:17:20 +02:00
|
|
|
else
|
|
|
|
outroTransitionScale = 1
|
|
|
|
end
|
|
|
|
|
|
|
|
outroTransitionGlobalAlpha = math.min(1, (outroTransitionScale*6))
|
|
|
|
|
|
|
|
outroTransitionEnterFlareX = math.min(2*1920, (
|
|
|
|
(outroTransitionScale-0.2)/0.1* -- Last from 0.2 transition scale for 0.1 transition scale, ending at 0.3 TS
|
|
|
|
(1920*2) -- move this amount during the transition
|
|
|
|
)-1920); -- start off-screen
|
2021-10-28 13:13:34 +02:00
|
|
|
|
|
|
|
outroTransitionTextCutX = math.min(1920, (
|
|
|
|
(outroTransitionScale-0.25)/0.2* -- Last from 0.25 transition scale for 0.2 transition scale, ending at 0.45 TS
|
|
|
|
(1920) -- reveal this amount during the transition (the whole width)
|
|
|
|
)-0); -- start from 0
|
2021-10-28 13:46:24 +02:00
|
|
|
|
2021-10-28 14:54:31 +02:00
|
|
|
local particleTransitionScale = Easing.outQuad(math.min(1,
|
|
|
|
(outroTransitionScale-0.25)/0.2) -- Last from 0.25 transition scale for 0.2 transition scale, ending at 0.45 TS
|
|
|
|
)
|
|
|
|
|
|
|
|
outroTransitionParticleRedX = math.min(1080+150, (
|
|
|
|
particleTransitionScale*
|
2021-10-28 15:16:55 +02:00
|
|
|
(1080+150)
|
|
|
|
)-500);
|
2021-10-28 14:54:31 +02:00
|
|
|
|
|
|
|
outroTransitionParticleSmallRainbowX = math.max(-1080-250, (
|
|
|
|
particleTransitionScale*
|
2021-10-28 15:16:55 +02:00
|
|
|
(-1080-250)
|
|
|
|
)+1080);
|
2021-10-28 14:54:31 +02:00
|
|
|
outroTransitionParticleSmallYellowRingAX = math.max(-1080+0, (
|
|
|
|
particleTransitionScale*
|
2021-10-28 15:16:55 +02:00
|
|
|
(-1080+0)
|
|
|
|
)+1080);
|
2021-10-28 14:54:31 +02:00
|
|
|
outroTransitionParticleSmallYellowRingBX = math.max(-1080+250, (
|
|
|
|
particleTransitionScale*
|
2021-10-28 15:16:55 +02:00
|
|
|
(-1080+250)
|
|
|
|
)+1080);
|
2021-10-28 14:54:31 +02:00
|
|
|
outroTransitionParticleSmallYellowRingCX = math.max(-1080+200, (
|
|
|
|
particleTransitionScale*
|
2021-10-28 15:16:55 +02:00
|
|
|
(-1080+200)
|
|
|
|
)+1080);
|
|
|
|
|
|
|
|
-- if (outroTransitionScale > 0.45 and outroTransitionScale < 0.5) then
|
|
|
|
-- if (outroTransitionScale <= 0.475) then
|
|
|
|
-- outroTransitionTextAlpha = 1-(0.5*((outroTransitionScale-0.45)/0.075))
|
|
|
|
-- else
|
|
|
|
-- outroTransitionTextAlpha = 0.5+0.5*((outroTransitionScale-0.475)/0.075)
|
|
|
|
-- end
|
|
|
|
-- else
|
|
|
|
-- outroTransitionTextAlpha = 1;
|
|
|
|
-- end
|
2021-10-28 13:46:24 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local drawParticles = function ()
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
2021-10-28 14:54:31 +02:00
|
|
|
outroTransitionParticleRedX-80,
|
|
|
|
510-80,
|
|
|
|
787*0.7,
|
|
|
|
818*0.7,
|
|
|
|
particleYellowRing,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
outroTransitionParticleRedX,
|
2021-10-28 13:46:24 +02:00
|
|
|
510,
|
|
|
|
787*0.5,
|
|
|
|
818*0.5,
|
|
|
|
particleRedBall,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
2021-10-28 14:54:31 +02:00
|
|
|
outroTransitionParticleRedX,
|
2021-10-28 13:46:24 +02:00
|
|
|
510,
|
|
|
|
787*0.5,
|
|
|
|
818*0.5,
|
|
|
|
particleRedRing,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
2021-10-28 14:54:31 +02:00
|
|
|
|
|
|
|
-- Right side
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
outroTransitionParticleSmallRainbowX,
|
|
|
|
465,
|
|
|
|
1117*0.5,
|
|
|
|
1117*0.5,
|
|
|
|
particleSmallRainbowRing,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
outroTransitionParticleSmallYellowRingAX,
|
|
|
|
575,
|
|
|
|
579*0.5,
|
|
|
|
557*0.5,
|
|
|
|
particleSmYellowRingA,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
outroTransitionParticleSmallYellowRingBX,
|
|
|
|
585,
|
|
|
|
436*0.5,
|
|
|
|
392*0.5,
|
|
|
|
particleSmYellowRingB,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
outroTransitionParticleSmallYellowRingCX,
|
|
|
|
625,
|
|
|
|
275*0.5,
|
|
|
|
275*0.5,
|
|
|
|
particleSmYellowRingC,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
2021-10-28 12:17:20 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local render = function (deltaTime)
|
|
|
|
tickTransitions(deltaTime);
|
|
|
|
gfx.GlobalAlpha(outroTransitionGlobalAlpha);
|
|
|
|
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
2160*0.5,
|
|
|
|
3840*0.5,
|
|
|
|
bgImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
2160*0.5,
|
|
|
|
1921*0.5,
|
|
|
|
bgHexTopImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
0,
|
|
|
|
1920-(1921*0.5),
|
|
|
|
2160*0.5,
|
|
|
|
1921*0.5,
|
|
|
|
bgHexBottomImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
|
|
|
|
-- Enter flares
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
outroTransitionEnterFlareX,
|
|
|
|
530,
|
|
|
|
3280*0.5,
|
|
|
|
790*0.5,
|
|
|
|
enterFlareBlueImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.ImageRect(
|
|
|
|
-outroTransitionEnterFlareX, -- go from the other side of the screen
|
|
|
|
530,
|
|
|
|
3280*0.5,
|
|
|
|
790*0.5,
|
|
|
|
enterFlarePinkImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
|
2021-10-28 13:46:24 +02:00
|
|
|
drawParticles();
|
|
|
|
|
2021-10-28 13:13:34 +02:00
|
|
|
gfx.BeginPath();
|
|
|
|
gfx.Scissor(0, 530, outroTransitionTextCutX, 1920)
|
2021-10-28 15:16:55 +02:00
|
|
|
gfx.GlobalAlpha(outroTransitionTextAlpha);
|
2021-10-28 13:13:34 +02:00
|
|
|
gfx.ImageRect(
|
|
|
|
0,
|
|
|
|
680,
|
|
|
|
2160*0.5,
|
|
|
|
177*0.5,
|
|
|
|
trackCompImage,
|
|
|
|
1,
|
|
|
|
0
|
|
|
|
);
|
2021-10-28 15:16:55 +02:00
|
|
|
gfx.GlobalAlpha(outroTransitionGlobalAlpha);
|
2021-10-28 13:13:34 +02:00
|
|
|
gfx.ResetScissor();
|
|
|
|
|
2021-10-28 12:17:20 +02:00
|
|
|
-- Get the banner downscaled in whatever resolution it is, while maintaining the aspect ratio
|
|
|
|
-- local tw,th = gfx.ImageSize(bannerBaseImage);
|
|
|
|
-- BANNER_H = th * (1080/tw);
|
|
|
|
|
|
|
|
-- gfx.BeginPath();
|
|
|
|
-- gfx.ImageRect(
|
|
|
|
-- 0,
|
|
|
|
-- 0,
|
|
|
|
-- BANNER_W,
|
|
|
|
-- BANNER_H,
|
|
|
|
-- bannerBaseImage,
|
|
|
|
-- 1,
|
|
|
|
-- 0
|
|
|
|
-- );
|
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
|
|
|
render=render
|
|
|
|
}
|