+ entry easing to filterwheel

This commit is contained in:
FajsiEx 2021-08-12 16:55:10 +02:00
parent de5174a76a
commit 32f201784d
4 changed files with 49 additions and 19 deletions

View File

@ -34,11 +34,11 @@ local function outQuad(t, b, c, d)
end end
local function inOutQuad(t, b, c, d) local function inOutQuad(t, b, c, d)
t = t / d * 2 t = t / 1 * 2
if t < 1 then if t < 1 then
return c / 2 * pow(t, 2) + b return 1 / 2 * pow(t, 2)
else else
return -c / 2 * ((t - 1) * (t - 3) - 1) + b return -1 / 2 * ((t - 1) * (t - 3) - 1)
end end
end end

View File

@ -98,6 +98,9 @@ local transitionScrollScale = 0;
local transitionScrollOffsetY = 0; local transitionScrollOffsetY = 0;
local scrollingUp = false; local scrollingUp = false;
local transitionEnterScale = 0;
local transitionEnterOffsetY = 0;
function resetLayoutInformation() function resetLayoutInformation()
resx, resy = game.GetResolution() resx, resy = game.GetResolution()
scale = resx / desw scale = resx / desw
@ -191,23 +194,25 @@ function drawFolderList()
folderList = filters.level; folderList = filters.level;
end end
yOffset = transitionEnterOffsetY + transitionScrollOffsetY
local i = 1; local i = 1;
while (i <= numOfItemsAround) do while (i <= numOfItemsAround) do
local index = getCorrectedIndex(selectedIndex, -i) local index = getCorrectedIndex(selectedIndex, -i)
drawFolder(folderList[index], desh / 2 - ITEM_HEIGHT / 2 - drawFolder(folderList[index], desh / 2 - ITEM_HEIGHT / 2 -
ITEM_HEIGHT * i + transitionScrollOffsetY) ITEM_HEIGHT * i + yOffset)
i = i + 1; i = i + 1;
end end
-- Draw the selected song -- Draw the selected song
drawFolder(folderList[selectedIndex], drawFolder(folderList[selectedIndex],
desh / 2 - ITEM_HEIGHT / 2 + transitionScrollOffsetY) desh / 2 - ITEM_HEIGHT / 2 + yOffset)
i = 1; i = 1;
while (i <= numOfItemsAround) do while (i <= numOfItemsAround) do
local index = getCorrectedIndex(selectedIndex, i) local index = getCorrectedIndex(selectedIndex, i)
drawFolder(folderList[index], desh / 2 - ITEM_HEIGHT / 2 + drawFolder(folderList[index], desh / 2 - ITEM_HEIGHT / 2 +
ITEM_HEIGHT * i + transitionScrollOffsetY) ITEM_HEIGHT * i + yOffset)
i = i + 1; i = i + 1;
end end
end end
@ -227,12 +232,20 @@ function tickTransitions(deltaTime)
else else
transitionScrollScale = 1 transitionScrollScale = 1
end end
if scrollingUp then if scrollingUp then
transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * ITEM_HEIGHT; transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * ITEM_HEIGHT;
else else
transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * -ITEM_HEIGHT; transitionScrollOffsetY = Easing.inQuad(1-transitionScrollScale) * -ITEM_HEIGHT;
end end
-- ENTRY TRANSITION
if transitionEnterScale < 1 then
transitionEnterScale = transitionEnterScale + deltaTime / 15 -- transition should last for that time in seconds
else
transitionEnterScale = 1
end
transitionEnterOffsetY = -Easing.inOutQuad(1-transitionEnterScale) * (desh+ITEM_HEIGHT*2+145);
end end
function drawFilterWheel(deltatime) function drawFilterWheel(deltatime)
@ -249,6 +262,7 @@ end
render = function(deltatime, shown) render = function(deltatime, shown)
if not shown then if not shown then
game.SetSkinSetting('_songWheelOverlayActive', 0); game.SetSkinSetting('_songWheelOverlayActive', 0);
transitionEnterScale = 0;
else else
game.SetSkinSetting('_songWheelOverlayActive', 1); game.SetSkinSetting('_songWheelOverlayActive', 1);
drawFilterWheel(deltatime) drawFilterWheel(deltatime)

View File

@ -123,8 +123,9 @@ local transitionAfterscrollTextSongArtist = 0;
local transitionAfterscrollDifficultiesAlpha = 0; local transitionAfterscrollDifficultiesAlpha = 0;
local transitionAfterscrollJacketBgAlpha = 0; local transitionAfterscrollJacketBgAlpha = 0;
local animationHeaderGlowScale = 0; local transitionLeaveActive = false;
local animationHeaderGlowAlpha = 0; local transitionLeaveScale = 0;
local transitionLeaveOffsetY = 0;
function resetLayoutInformation() function resetLayoutInformation()
resx, resy = game.GetResolution() resx, resy = game.GetResolution()
@ -314,21 +315,22 @@ end
function drawSongList() function drawSongList()
local numOfSongsAround = 7; -- How many songs should be up and how many should be down of the selected one local numOfSongsAround = 7; -- How many songs should be up and how many should be down of the selected one
local yOffset = transitionLeaveOffsetY + transitionScrollOffsetY;
local i=1; local i=1;
while (i <= numOfSongsAround) do while (i <= numOfSongsAround) do
local songIndex = getCorrectedIndex(selectedIndex, -i) local songIndex = getCorrectedIndex(selectedIndex, -i)
drawSong(songwheel.songs[songIndex], desh/2-songPlateHeight/2-songPlateHeight*i + transitionScrollOffsetY) drawSong(songwheel.songs[songIndex], desh/2-songPlateHeight/2-songPlateHeight*i + yOffset)
i=i+1; i=i+1;
end; end;
-- Draw the selected song -- Draw the selected song
drawSong(songwheel.songs[selectedIndex], desh/2-songPlateHeight/2 + transitionScrollOffsetY) drawSong(songwheel.songs[selectedIndex], desh/2-songPlateHeight/2 + yOffset)
i=1; i=1;
while (i <= numOfSongsAround) do while (i <= numOfSongsAround) do
local songIndex = getCorrectedIndex(selectedIndex, i) local songIndex = getCorrectedIndex(selectedIndex, i)
drawSong(songwheel.songs[songIndex], desh/2-songPlateHeight/2+songPlateHeight*i + transitionScrollOffsetY) drawSong(songwheel.songs[songIndex], desh/2-songPlateHeight/2+songPlateHeight*i + yOffset)
i=i+1; i=i+1;
end; end;
end end
@ -522,6 +524,19 @@ function tickTransitions(deltaTime)
else else
transitionAfterscrollJacketBgAlpha = 1; transitionAfterscrollJacketBgAlpha = 1;
end end
-- Leave transition
if transitionLeaveScale < 1 then
transitionLeaveScale = transitionLeaveScale + deltaTime / 15 -- transition should last for that time in seconds
else
transitionLeaveScale = 1
end
if (transitionLeaveActive) then
transitionLeaveOffsetY = Easing.inOutQuad(transitionLeaveScale) * (desh+songPlateHeight*2+145);
else
transitionLeaveOffsetY = 0;
end
end end
@ -543,11 +558,12 @@ render = function (deltaTime)
drawSearch(); drawSearch();
-- if (game.GetSkinSetting('_songWheelOverlayActive') ~= 1) then if (game.GetSkinSetting('_songWheelOverlayActive') ~= 1) then
-- SongSelectHeader.draw(deltaTime); transitionLeaveActive = false;
-- Footer.draw(); transitionLeaveScale = 0;
-- end else
transitionLeaveActive = true;
end
gfx.BeginPath(); gfx.BeginPath();
gfx.FontSize(18) gfx.FontSize(18)

View File

@ -1,4 +1,4 @@
username = "GSKBLADE" username = "GSKBLADE"
_gaugeType = 2.000000 _songWheelOverlayActive = 0.000000
_gaugeARS = 1.000000 .000000
_songWheelOverlayActive = 0.000000 _songWheelOverlayActive = 0.000000