Jump to content

interpolateBetween | Question


Recommended Posts

Hey guys, i have a Problem.

i wanted to try the interpolateBetween function.

local screenx,screeny = guiGetScreenSize() 
-- animation 
local state = 'starting' 
local phase = 0 
local alpha = 0 
local lastTick = getTickCount() 
  
local function getProgress( addtick ) 
    local now = getTickCount() 
    local elapsedTime = now - lastTick 
    local duration = lastTick+addtick - lastTick 
    local progress = elapsedTime / duration 
    return progress 
end 
  
local RectangleX,RectangleY = interpolateBetween(screenx/2-250, 0-screeny, 0, screenx/2-250, 0, 0, getProgress(10000), 'Linear') 
  
function draw() 
    dxDrawRectangle(RectangleX, RectangleY, 500, screeny, tocolor(27, 122, 224, 255)) 
    showCursor(false) 
end 
  
addEventHandler("onClientResourceStart",getRootElement(), draw) 
addEventHandler("onClientRender", root, draw) 

the server says no errors.

But it dont do that, what i want to do

Please help me

Link to comment
  
local screenx,screeny = guiGetScreenSize() 
-- animation 
local state = 'starting' 
local phase = 0 
local alpha = 0 
local lastTick = getTickCount() 
  
local function getProgress( addtick ) 
    local now = getTickCount() 
    local elapsedTime = now - lastTick 
    local duration = lastTick+addtick - lastTick 
    local progress = elapsedTime / duration 
    return progress 
end 
  
function draw() 
     local RectangleX,RectangleY = interpolateBetween(screenx/2-250, 0-screeny, 0, screenx/2-250, 0, 0, getProgress(10000), 'Linear')  
    dxDrawRectangle(RectangleX, RectangleY, 500, screeny, tocolor(27, 122, 224, 255)) 
    showCursor(false) 
end 
addEventHandler("onClientRender", root, draw) 

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...