Jump to content

Animation


Hugos

Recommended Posts

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.

Link to comment
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?

  • Like 1
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...