BolonZX Posted June 27, 2015 Share Posted June 27, 2015 so I've been working all night on trying to make a new menu button using dx functions (dxDrawRectangle, dxDrawText, etc) and I want to give it animation, for example: the button would be like this by default.. but when a player clicks on it the button should slide to the left with an animation. so far this is what I got, I managed to display the dxRectangles using dxDrawAnimWindow . You can still see the InterpolateBetween function is there but I really don't know what to do, I got a really big mess here. local x, y = guiGetScreenSize ( ) function main() start = getTickCount() addEventHandler ( "onClientRender", getRootElement(), window ) end addEventHandler("onClientResourceStart", getResourceRootElement(), main ) function window (ancho, alto) local color = tocolor(211, 211, 211, 66) xdDrawAnimWindow("hue",x * 0.1179,y * 0.0807,color,"default-bold","OutBounce") end function xdDrawAnimWindow(text,alto,ancho,color,font,anim) btAncho = ancho btAlto = alto/20 local now = getTickCount() local elapsedTime = now - start local endTime = start + 1500 local duration = endTime - start local progress = elapsedTime / duration local x1, y1, z1 = interpolateBetween ( 0, 0, 0, ancho, alto, 255, progress, anim) local x2, y2, z2 = interpolateBetween ( 0, 0, 0, btAncho, btAlto, btAlto/11, progress, anim) posx = (x/2)-(x1/2) posy = (y/2)-(y1/2) dxDrawRectangle ( x * 0.8712, y * 0.0039, x * 0.1179, y * 0.0807, tocolor(211, 211, 211, 66) ) dxDrawRectangle ( x * 0.8514, y * 0.0039, x * 0.0198, y * 0.0807, tocolor(10, 190, 188, 255) ) --Para obtener mas animaciones visita [url=https://wiki.multitheftauto.com/wiki/Easing]https://wiki.multitheftauto.com/wiki/Easing[/url] end 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