+ 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
local function inOutQuad(t, b, c, d)
t = t / d * 2
t = t / 1 * 2
if t < 1 then
return c / 2 * pow(t, 2) + b
return 1 / 2 * pow(t, 2)
else
return -c / 2 * ((t - 1) * (t - 3) - 1) + b
return -1 / 2 * ((t - 1) * (t - 3) - 1)
end
end

View File

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

View File

@ -123,8 +123,9 @@ local transitionAfterscrollTextSongArtist = 0;
local transitionAfterscrollDifficultiesAlpha = 0;
local transitionAfterscrollJacketBgAlpha = 0;
local animationHeaderGlowScale = 0;
local animationHeaderGlowAlpha = 0;
local transitionLeaveActive = false;
local transitionLeaveScale = 0;
local transitionLeaveOffsetY = 0;
function resetLayoutInformation()
resx, resy = game.GetResolution()
@ -314,21 +315,22 @@ end
function drawSongList()
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;
while (i <= numOfSongsAround) do
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;
end;
-- Draw the selected song
drawSong(songwheel.songs[selectedIndex], desh/2-songPlateHeight/2 + transitionScrollOffsetY)
drawSong(songwheel.songs[selectedIndex], desh/2-songPlateHeight/2 + yOffset)
i=1;
while (i <= numOfSongsAround) do
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;
end;
end
@ -522,6 +524,19 @@ function tickTransitions(deltaTime)
else
transitionAfterscrollJacketBgAlpha = 1;
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
@ -543,11 +558,12 @@ render = function (deltaTime)
drawSearch();
-- if (game.GetSkinSetting('_songWheelOverlayActive') ~= 1) then
-- SongSelectHeader.draw(deltaTime);
-- Footer.draw();
-- end
if (game.GetSkinSetting('_songWheelOverlayActive') ~= 1) then
transitionLeaveActive = false;
transitionLeaveScale = 0;
else
transitionLeaveActive = true;
end
gfx.BeginPath();
gfx.FontSize(18)

View File

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