Ok I don't like the lerping

This commit is contained in:
Fesiug 2023-12-09 21:28:54 -05:00
parent 917b18b45b
commit 928d9a7600
1 changed files with 24 additions and 36 deletions

View File

@ -187,19 +187,17 @@ local function multlinetext(text, maxw, font)
end end
local h_F, s_F, v_F = 224, 0.00, 0.40 local h_F, s_F, v_F = 224, 0.00, 0.40
local h_D, s_D, v_D = 224, 0.20, 0.40 local h_D, s_D, v_D = 180, 0.40, 0.40
local h_C, s_C, v_C = 90, 0.40, 0.50 local h_C, s_C, v_C = 140, 0.40, 0.50
local h_B, s_B, v_B = 60, 0.60, 0.80 local h_B, s_B, v_B = 40, 0.60, 0.90
local h_A, s_A, v_A = 12, 0.70, 0.80 local h_A, s_A, v_A = 24, 0.70, 0.90
local h_S, s_S, v_S = 0, 0.75, 0.80 local h_S, s_S, v_S = 0, 0.75, 0.90
local function rank( perc ) local function rank( perc )
local letter local letter
local color local color
if perc <= 1/10 then if perc <= 1/10 then
letter = "F" letter = "F"
local ler = math.ease.OutExpo( math.Remap( perc, 0, 1/10, 0, 1 ) )
color = HSVToColor( color = HSVToColor(
h_F, h_F,
s_F, s_F,
@ -207,48 +205,38 @@ local function rank( perc )
) )
elseif perc <= 3/10 then elseif perc <= 3/10 then
letter = "D" letter = "D"
local ler = math.ease.OutExpo( math.Remap( perc, 1/10, 3/10, 0, 1 ) )
color = HSVToColor( color = HSVToColor(
Lerp( ler, h_F, h_D ), h_D,
Lerp( ler, s_F, s_D ), s_D,
Lerp( ler, v_F, v_D ) v_D
) )
elseif perc <= 5/10 then elseif perc <= 5/10 then
letter = "C" letter = "C"
local ler = math.ease.OutExpo( math.Remap( perc, 3/10, 5/10, 0, 1 ) )
color = HSVToColor( color = HSVToColor(
Lerp( ler, h_D, h_C ), h_C,
Lerp( ler, s_D, s_C ), s_C,
Lerp( ler, v_D, v_C ) v_C
) )
elseif perc <= 7/10 then elseif perc <= 7/10 then
letter = "B" letter = "B"
local ler = math.ease.OutExpo( math.Remap( perc, 5/10, 7/10, 0, 1 ) )
color = HSVToColor( color = HSVToColor(
Lerp( ler, h_C, h_B ), h_B,
Lerp( ler, s_C, s_B ), s_B,
Lerp( ler, v_C, v_B ) v_B
) )
elseif perc <= 9/10 then elseif perc <= 9/10 then
letter = "A" letter = "A"
local ler = math.ease.OutExpo( math.Remap( perc, 7/10, 9/10, 0, 1 ) )
color = HSVToColor( color = HSVToColor(
Lerp( ler, h_B, h_A ), h_A,
Lerp( ler, s_B, s_A ), s_A,
Lerp( ler, v_B, v_A ) v_A
) )
elseif perc <= 1 then elseif perc <= 1 then
letter = "S" letter = "S"
local ler = math.ease.OutExpo( math.Remap( perc, 9/10, 1, 0, 1 ) )
color = HSVToColor( color = HSVToColor(
Lerp( ler, h_A, h_S ), h_S,
Lerp( ler, s_A, s_S ), s_S,
Lerp( ler, v_A, v_S ) v_S
) )
end end
return letter, color return letter, color
@ -258,7 +246,7 @@ function OpenSMenu()
if IsValid( smenu ) then smenu:Remove() return end if IsValid( smenu ) then smenu:Remove() return end
local active = GetConVar("benny_hud_tempactive"):GetString() local active = GetConVar("benny_hud_tempactive"):GetString()
smenu = vgui.Create("BFrame") smenu = vgui.Create("BFrame")
smenu:SetSize( ss(520), ss(360) ) smenu:SetSize( ss(440), ss(360) )
smenu:SetTitle("Developer Spawnmenu") smenu:SetTitle("Developer Spawnmenu")
smenu:MakePopup() smenu:MakePopup()
smenu:SetKeyboardInputEnabled( false ) smenu:SetKeyboardInputEnabled( false )
@ -269,7 +257,7 @@ function OpenSMenu()
smenu:Center() smenu:Center()
local statlist = smenu:Add("DPanel") local statlist = smenu:Add("DPanel")
statlist:SetWide( ss(300) ) statlist:SetWide( ss(440/2) )
statlist:Dock( RIGHT ) statlist:Dock( RIGHT )
statlist:DockMargin( ss(2), 0, 0, 0 ) statlist:DockMargin( ss(2), 0, 0, 0 )
statlist:DockPadding( ss(2), ss(2), ss(2), ss(2) ) statlist:DockPadding( ss(2), ss(2), ss(2), ss(2) )
@ -320,7 +308,7 @@ function OpenSMenu()
local rank, col = rank( perc ) local rank, col = rank( perc )
surface.SetDrawColor( schema("fg") ) surface.SetDrawColor( schema("fg") )
surface.DrawRect( ss(60), 0, ss(1), h ) surface.DrawRect( ss(60), 0, ss(1), h )
draw.SimpleText( rank, us.Font, ss(60+4), ss(2), schema_c("fg") ) draw.SimpleText( rank, us.Font, ss(60+4), ss(2), col )
surface.DrawRect( ss(60)+h, 0, ss(1), h ) surface.DrawRect( ss(60)+h, 0, ss(1), h )
surface.SetDrawColor( col ) surface.SetDrawColor( col )
@ -330,7 +318,7 @@ function OpenSMenu()
--surface.DrawOutlinedRect( ss(60+1)+h, ss(0.5), width, h-ss(1), ss(2) ) --surface.DrawOutlinedRect( ss(60+1)+h, ss(0.5), width, h-ss(1), ss(2) )
for i=1, 10 do for i=1, 10 do
if i==1 then continue end if i==1 then continue end
surface.SetDrawColor( schema("fg", i%2==1 and 0.01 or 1) ) surface.SetDrawColor( schema("fg", i%2==1 and 0.008 or 0.12) )
surface.DrawRect( ss(60)+h + width*(i-1)/10, 0, ss(1), h ) surface.DrawRect( ss(60)+h + width*(i-1)/10, 0, ss(1), h )
end end
end end