aka Blue Posted November 13, 2016 Posted November 13, 2016 (edited) Buenas. Últimamente he intentado aprender cómo hacer varias cosas. Entre una de ellas (en la cual no me aclaro), está el crear una animación DX. Es decir, digamos que tenemos 3 botones arriba pequeños y quiero que al pasar el mouse por encima, éstos se tiren hacia abajo, agrandandose con un pequeño efecto, es decir, con unos segundos de retraso, bajando lentamente. Algo así: ¿Cómo debería hacerlo? Muchas gracias. Edited November 13, 2016 by aka Blue
ميدوح Posted November 13, 2016 Posted November 13, 2016 (edited) https://wiki.multitheftauto.com/wiki/DxDrawAnimWindow Edited November 13, 2016 by medo7
aka Blue Posted November 13, 2016 Author Posted November 13, 2016 (edited) @medo7 Sorry but i dont want to make a window, i want to make an animated DX Rectangle that moves down with some transition efect when the mouse is on. Edited November 13, 2016 by aka Blue
TRtam Posted November 13, 2016 Posted November 13, 2016 (edited) Aqui te dejo un ejemplo bastante sencillo: function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end local sizeY = 10 addEventHandler("onClientRender",root, function() if isMouseInPosition(100,200, 200,sizeY) do -- Si el mouse esta en esa posicion entonces se agrandara sizeY = math.min(sizeY + 5, 50) else -- Si esta fuera se achicara sizeY = math.max(sizeY - 5, 10) end dxDrawRectangle(100,200, 200,sizeY, tocolor(255,157,0)) end ) Edited November 13, 2016 by saygoodbye
aka Blue Posted November 14, 2016 Author Posted November 14, 2016 Justo lo que buscaba @saygoodbye, muchas gracias. Pensé que tendría que hacer cálculos con getTickCount y cosas raras, no pensé en math.min y math.max
TRtam Posted November 14, 2016 Posted November 14, 2016 Jaja, de nada. Yo antes tambien pensaba en hacer calculos con getTickCount, pero un dia conoci los poderes del math.min y math.max :'v
Recommended Posts