Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. for i, v in pairs(data.ripples) do 
  2.                 v.l = max(v.l - 5, x)
  3.                 v.t = max(v.t - 1, y)
  4.                 v.r = min(v.r + 5, x + w)
  5.                 v.b = min(v.b + 1, y + h)
  6.            
  7.                 dxDrawRoundedRectangle(v.l, v.t, v.r - v.l, v.b - v.t, tocolor(0, 0, 0, 100 * v.alpha * alpha), v.lt, v.lb, v.rt, v.rb, postGUI)
  8.                
  9.                 if v.l < (x + 5) and v.t < (y + 5) then v.lt = max(v.lt - 1, 0) end
  10.                 if v.r > (x + w - 5) and v.t < (y + 5) then v.rt = max(v.rt - 1, 0) end
  11.                 if v.l < (x + 5) and v.b > (y + h - 5) then v.lb = max(v.lb - 1, 0) end
  12.                 if v.r > (x + w - 5) and v.b > (y + h - 5) then v.rb = max(v.rb - 1, 0) end
  13.                
  14.                 if v.l == x and v.r == x + w then
  15.                     v.alpha = max(v.alpha - 0.03, 0)
  16.                    
  17.                     if v.alpha == 0 then
  18.                         data.ripples[i] = nil
  19.                     end
  20.                 end
  21.             end
  22.         end
  23.     end
  24. end
  25.  
  26. function Buttons:onClientClickButton(button, state, x, y)
  27.     if button == "left" and state == "down" then
  28.         for buttonID, buttonData in pairs(self.buttons) do
  29.             if isMouseInPosition(buttonData.x, buttonData.y, buttonData.w, buttonData.h) then
  30.                 buttonData.onClick()
  31.                
  32.                 local ripple_id = #buttonData.ripples + 1
  33.                 local radius = buttonData.h / 2
  34.                
  35.                 buttonData.ripples[ripple_id] = {}
  36.                 buttonData.ripples[ripple_id].alpha = 1
  37.                 buttonData.ripples[ripple_id].l = x - radius
  38.                 buttonData.ripples[ripple_id].t = y - radius
  39.                 buttonData.ripples[ripple_id].r = x + radius
  40.                 buttonData.ripples[ripple_id].b = y + radius
  41.                
  42.                 buttonData.ripples[ripple_id].lt = radius
  43.                 buttonData.ripples[ripple_id].lb = radius
  44.                 buttonData.ripples[ripple_id].rt = radius
  45.                 buttonData.ripples[ripple_id].rb = radius
  46.                 break
  47.             end
  48.         end
  49.     end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement