Jump to content

How to use InterpolateBetween on dxDrawings


Recommended Posts

Of course you won't understand it if you refuse to even try to understand it.

Some of the examples there are a bit over the top for those new to the function, but the last example is easy enough to understand the basics of it. As previously mentioned - play around with it.

In the end, trial and error is a big part of coding.

Link to comment

for me i use it like that :

local prog = 0 
addEventHandler('onClientRender',root, 
function() 
prog = math.min(prog+0.02,1) 
cX,cY,cX = interpolateBetween(0, 0, 0, 0, 10, 0,prog,"Linear") 
dxDrawRectangle(100,cY,100,100) 
end 
) 

there's other way but this is better for me

Link to comment

A simple example with time values:

  
local tick = getTickCount() 
local duration = 6000 -- 6 seconds (ms) 
addEventHandler("onClientRender", root, 
    function() 
        local progress = ((getTickCount() - tick)/duration) 
        local cX, cY = interpolateBetween(0, 0, 0, 0, 10, 0, progress, "Linear") 
        dxDrawRectangle(cX, cY, 100, 100) 
    end 
) 
  

Edited by Guest
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...