Potato_Tomato420 Posted July 15, 2020 Posted July 15, 2020 Hello, I'm currently trying to work with DX drawing for my server. Can somebody explain to me how to move a dxDrawRectangle on the screen? For example when I press F1 the dxDrawRectangle will move with animation to the right or left side of the screen. Thx!
Gw8 Posted July 15, 2020 Posted July 15, 2020 local screenH, screenW = guiGetScreenSize() local x,y = (screenH/1366),(screenW/768) local effect = { alpha = 0, tick = getTickCount(), state = false, x = 0 } function pdx() local progress = math.min((getTickCount()-effect.tick)/3000,1) if effect.state then effect.alpha,effect.x = interpolateBetween(effect.alpha,effect.x,0,1,x*300,0,progress,"Linear") else effect.alpha,effect.x = interpolateBetween(effect.alpha,effect.x,0,0,0,0,progress,"Linear") if progress >= 0.9 then removeEventHandler("onClientRender",root,pdx) end end dxDrawRectangle(effect.x,y*221,x*323,y*248,tocolor(0,0,0,255*effect.alpha)) end function abrirdx() effect.state = not effect.state effect.tick = getTickCount() showCursor(effect.state) if effect.state then removeEventHandler("onClientRender",root,pdx) addEventHandler("onClientRender",root,pdx) end end bindKey("x","down",abrirdx) I didn't test
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