Hugos Posted September 22, 2019 Posted September 22, 2019 Hello to everyone. Please help. iStartTick = getTickCount() function StartAnimation() local iProgress = (getTickCount()-iStartTick)/1000 local x1 = interpolateBetween(-(y/1.6), 0, 0, 0, 0, 0, iProgress, "OutBack") local x2 = interpolateBetween(-(y/70), 0, 0, y/1.6-y/70, 0, 0, iProgress, "OutBack") dxDrawRectangle(x1, y-y/7.5, y/1.6, y/15, tocolor(0, 0, 0), true) dxDrawRectangle(x2, y-y/7.5, y/70, y/15, tocolor(255, 50, 65), true) dxDrawText("ERROR!", x1, y-y/7.5, x1+y/1.6, y-y/7.5+y/15, tocolor(200, 200, 200), 1, Font, "center", "center", true, false, true) if (iProgress >= 1) then iStartTick = 0; removeEventHandler("onClientRender", root, StartAnimation) end end addEventHandler("onClientRender", root, StartAnimation) I have such animation (rectangle "leaves" on the left side and then goes missing), I need this rectangle not to chill, but to stay for 3 seconds and with the same animation "left" to the initial position (reverse animation). But I don 't know how to do it. Говорю на русском. Sorry for bad english.
Moderators IIYAMA Posted September 22, 2019 Moderators Posted September 22, 2019 6 minutes ago, Hugos said: But I don 't know how to do it. Block the progress local timeNow = getTickCount() local iProgress = (timeNow - iStartTick)/1000 if iProgress > 1 then iProgress = 1 end Stop the animation 3 seconds after the end time. if ((timeNow - iStartTick) / 1300) >= 1 then 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Hugos Posted September 22, 2019 Author Posted September 22, 2019 2 minutes ago, IIYAMA said: Block the progress local timeNow = getTickCount() local iProgress = (timeNow - iStartTick)/1000 if iProgress > 1 then iProgress = 1 end Stop the animation 3 seconds after the end time. if ((timeNow - iStartTick) / 1300) >= 1 then Do you want to write this code after 8 lines? 1 Говорю на русском. Sorry for bad english.
Moderators IIYAMA Posted September 22, 2019 Moderators Posted September 22, 2019 Just now, Hugos said: Do you want to write this code after 8 lines? The second code is the condition for removing the handler. 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Hugos Posted September 22, 2019 Author Posted September 22, 2019 Just now, IIYAMA said: The second code is the condition for removing the handler. THANKS!) 1 Говорю на русском. Sorry for bad english.
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