Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. def mouse_gradient(radius):
  2. mp = mouse_pos() # custom function, just wraps fetching mouse coords from sdl2
  3. mouse_grad = None
  4. mouse_grad = aggdraw.Draw('RGBA', (radius, radius), (0, 0, 0, 0))
  5. for n in range(radius):
  6. n = float(n)
  7. r = float(radius - n)
  8. opacity = int(( 0.25 * n / radius) * 100)
  9. brush = aggdraw.Brush((255, 0, 0), int(opacity))
  10. tl = (radius - r) // 2
  11. br = (radius - r) // 2 + r
  12. mouse_grad.ellipse((tl, tl, br, br), brush)
  13.  
  14. return mouse_grad # where it is subsequently blit to the screen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement