Jump to content

Animate


Hugos

Recommended Posts

Most animations are driven by an easing function - the simplest of which is Linear, but you could write your own easing equation - for example, y = x+math.sin(6.29x) if you want to, but most likely you won't need it. If you want something to appear smoothinly, use the return of an easing function as the alpha parameter; if you want it to slide onto the screen, use it for x or y position.

Edited by MrTasty
  • Thanks 1
Link to comment
3 hours ago, MrTasty said:

Most animations are driven by an easing function - the simplest of which is Linear, but you could write your own easing equation - for example, y = x+math.sin(6.29x) if you want to, but most likely you won't need it. If you want something to appear smoothinly, use the return of an easing function as the alpha parameter; if you want it to slide onto the screen, use it for x or y position.

Oh, right! Thanks))
And how I didn 't think of it.

Link to comment
local yourtick = getTickCount()
local alpha = 0

function yourFunctionRendering()
	local progresstick = getTickCount() - yourtick
	local progress = progresstick/500
	if progress >= 1 then progress = 1 end
	alpha = interpolateBetween(0,0,0,1,0,0,progress,"Linear")
	--NOW YOUR FUNCTION
	guiSetAlpha ( yourWindow, alpha )
end
addEventHandler("onClientRender",root,yourFunctionRendering)

Something like this. Remember that eachtime you need to update the animation you have to restart 'yourtick'

And deal with the condition to fadeout. I've just give you an example of fadein without the condition.

Regards.

  • Thanks 1
Link to comment
9 hours ago, Overkillz said:

local yourtick = getTickCount()
local alpha = 0

function yourFunctionRendering()
	local progresstick = getTickCount() - yourtick
	local progress = progresstick/500
	if progress >= 1 then progress = 1 end
	alpha = interpolateBetween(0,0,0,1,0,0,progress,"Linear")
	--NOW YOUR FUNCTION
	guiSetAlpha ( yourWindow, alpha )
end
addEventHandler("onClientRender",root,yourFunctionRendering)

Something like this. Remember that eachtime you need to update the animation you have to restart 'yourtick'

And deal with the condition to fadeout. I've just give you an example of fadein without the condition.

Regards.

Thanks!

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...