PartyMTA Posted February 14, 2015 Share Posted February 14, 2015 //With math based animation i mean ex; alpha = alpha + 1 Hello everyone. I am working on login panel with animation like mentioned above this line. Running the event first time works fine, but when i run it AGAIN, it doesnt detect when to stop. First time run is when resource start, and second time when i click a button (which does it perfectly) function loginAnim() if components.login.startPosX>stopanimpos1 then components.login.startPosX = components.login.startPosX - 10 if components.login.startPosX==stopanimpos1 then components.login.startPosX = stopanimpos1 end end end function loginAnim2() if components.login.startPosX<=stopanimpos1 then components.login.startPosX = components.login.startPosX - 10 if components.login.startPosX==0 then removeEventHandler("onClientRender",getRootElement(),login) components.login.startPosX = x end end end loginAnim is for opening, loginAnim2 for closing. It's windows 8 styled btw Link to comment
.:HyPeX:. Posted February 15, 2015 Share Posted February 15, 2015 Please remember animations (If they're smooth) can always exceed the == parameter, (1.009 instead of 1), use >= and <= instead. For example: local start = getTickCount() function call() local now = getTickCount() local progress = (now-start)/1000 if progress >= 1 then -- Progress of exact values can often be overriden removeEventHandler('onClientRender',root,call) end end addEventHandler('onClientRender',root,call) Else, i cant find any other problem in this code, if my posted solution doesnt work, post the rest of the code wich involves this (Mainly the variables wich you're using and what this affects) 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