Hey guys so I'm trying to create a window made out of dx drawings, I want to be able to use the same bind to open it and close it, But I also want it to be animated when it opens and closes. So far its not working.
This is what I got so far:
Client
local screenW, screenH = guiGetScreenSize()
local start = getTickCount()
---Variables-----
local one, one1 = screenW * 1.0000, screenH * 0.0000 ---- The coordinates of the beginning
local two, two1 = screenW * 0.8477, screenH * 0.0000 ---- The coordinates of the end
--------------------------------------
----DxDrawings and Animations-----
function PanelOpen()
local width, height = screenW * 0.1523, screenH * 1.0000 ---- The size of the dx rectangle
local now = getTickCount()
local x,y = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 1000) - start), "OutBounce")
dxDrawRectangle(x,y, width, height, tocolor(0, 0, 0, 164), false)
end
function PanelClose()
local width, height = screenW * 0.1523, screenH * 1.0000 ---- The size of the dx rectangle
local now = getTickCount()
local x,y = interpolateBetween(two, two1, 0, one, one1, 0, (now - start) / ((start + 1000) - start), "Linear")
dxDrawRectangle(x,y, width, height, tocolor(0, 0, 0, 164), false)
end
------------------------------
-------Render of the drawings-------------
function RenderPanel()
addEventHandler("onClientRender", root, PanelOpen)
end
function RenderPanel2()
addEventHandler("onClientRender", root, PanelClose)
end
------------------------------------------
---------Binds-----------
bindKey("U", "down", RenderPanel)
bindKey("U", "up", RenderPanel2)