MisterQuestions Posted November 22, 2014 Share Posted November 22, 2014 Hey, i got a dude, and its how to use that function 'InterpolateBetween' on dxElements Like texts, rectangles, etc... Link to comment
Sasu Posted November 22, 2014 Share Posted November 22, 2014 Just play with the function. Try the example that wiki provide. Link to comment
MisterQuestions Posted November 23, 2014 Author Share Posted November 23, 2014 Noo i dont understand it Link to comment
Dealman Posted November 23, 2014 Share Posted November 23, 2014 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
MisterQuestions Posted November 24, 2014 Author Share Posted November 24, 2014 I just understood the camera example... Link to comment
Sasu Posted November 24, 2014 Share Posted November 24, 2014 Good, if you have some problem with the script, dont hesitate to post it. Link to comment
ALw7sH Posted November 24, 2014 Share Posted November 24, 2014 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
Feche1320 Posted November 25, 2014 Share Posted November 25, 2014 local prog = 0 addEventHandler('onClientRender',root, function() prog = prog < 1 and prog + 0.02 or 1 cX,cY,cX = interpolateBetween(0, 0, 0, 0, 10, 0,prog,"Linear") dxDrawRectangle(100,cY,100,100) end ) I think that is faster rather than math.min, not sure tought. Link to comment
MisterQuestions Posted November 30, 2014 Author Share Posted November 30, 2014 another way to get progress? Link to comment
Bonsai Posted November 30, 2014 Share Posted November 30, 2014 Yes, check Wiki Example! Link to comment
novo Posted November 30, 2014 Share Posted November 30, 2014 (edited) 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 June 26, 2015 by Guest Link to comment
MisterQuestions Posted December 5, 2014 Author Share Posted December 5, 2014 Finally got it! Thanks all, but now, how to make it infinite? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now