AJXB Posted April 7, 2014 Share Posted April 7, 2014 local px, py = guiGetPosition ( pic,false ) local sx,sy = guiGetScreenSize () function onRender( ) if state == 'OpenIt' then local nx, ny = interpolateBetween ( px, py,0,px,(py/3)+85,0,getProgress( 3000 ),"OutElastic",0.3, 1.0 ) guiSetPosition( pic, nx, ny, false ) elseif state == 'CloseIt' then local nx, ny = interpolateBetween ( px, py,0,px,(py/3)+475,0,getProgress( 3000 ),"OutElastic",0.3, 1.0 ) guiSetPosition( pic, nx, ny, false ) end end addEventHandler( 'onClientRender', root, onRender ); So I've managed to kinda make it move in the way I want, but when I trigger a function that will open the picture and trigger another to close it, it does not animate like it used to, I mean first time I start the resource and trigger openIt, OutElastic works, then I close it, Now the second time I open it, It doesn't animate, what's the issue ? Link to comment
iPrestege Posted April 7, 2014 Share Posted April 7, 2014 State isn't defined anywhere? Link to comment
AJXB Posted April 7, 2014 Author Share Posted April 7, 2014 It is, outside of this code, I put "state = 'CloseIt'" Link to comment
50p Posted April 7, 2014 Share Posted April 7, 2014 What do you mean it doesn't animate? Does it still "open" or not? To me it looks like messed up coords. Link to comment
AJXB Posted April 7, 2014 Author Share Posted April 7, 2014 Well, to explain, there are 2 steps, Open, and close, When I open it, all good, close works too, but the animate, the interpolatebetween and the OutElastic aren't working, When I open it for the second time, It only sets the position, Like interpolateBetween doesn't exist. Link to comment
AJXB Posted April 7, 2014 Author Share Posted April 7, 2014 What can I do to change that? I mean what could cause it ? Link to comment
AJXB Posted April 8, 2014 Author Share Posted April 8, 2014 I solved it by adding lastTick = getTickCount( ); everytime the value changes, as FabioGNR advised Thank you 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