Jump to content

[ HELP ] interpolateBetween Progress


Keilbritschn

Recommended Posts

Hey guys, i have a problem. I want, that the interpolateBetween counts if i press F6, but it counts if the Resource starts.

local screenW,screenH = guiGetScreenSize() 
local state = "Login" 
local phase = 0 
local lastTick = getTickCount() 
  
function setSettings( s, p )  
    state = s or 'Login' 
    phase = p or 0 
    lastTick = getTickCount() 
end  
  
function getProgress( addtick ) 
    local now = getTickCount() 
    local elapsedTime = now - lastTick 
    local duration = lastTick+addtick - lastTick 
    local progress = elapsedTime / duration 
    return progress 
end 
  
function drawInterface () 
    local InterfaceBreite = interpolateBetween(0,0,0,250,250,250,getProgress(500),"InOutQuad") 
    dxDrawRectangle ( 0, 0, InterfaceBreite, screenH, tocolor ( 23, 23, 23, 255 ) ) 
    showChat(false) 
end 
  
function drawInterfaceRender ( ) 
    addEventHandler("onClientRender", getRootElement(), drawInterface) 
end 
  
bindKey("F6","down",drawInterfaceRender) 

Link to comment

Try.

local screenW,screenH = guiGetScreenSize() 
local state = "Login" 
local phase = 0 
  
function setSettings( s, p ) 
    state = s or 'Login' 
    phase = p or 0 
    lastTick = getTickCount() 
end 
  
function getProgress( addtick ) 
    local now = getTickCount() 
    local elapsedTime = now - lastTick 
    local duration = lastTick+addtick - lastTick 
    local progress = elapsedTime / duration 
    return progress 
end 
  
function drawInterface () 
    local InterfaceBreite = interpolateBetween(0,0,0,250,250,250,getProgress(500),"InOutQuad") 
    dxDrawRectangle ( 0, 0, InterfaceBreite, screenH, tocolor ( 23, 23, 23, 255 ) ) 
    showChat(false) 
end 
  
function drawInterfaceRender ( ) 
    lastTick = getTickCount() 
    addEventHandler("onClientRender", getRootElement(), drawInterface) 
end 
  
bindKey("F6","down",drawInterfaceRender) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...