Posted By


n3x on 06/20/07

Tagged


Statistics


Viewed 441 times
Favorited by 0 user(s)

NodeBox test: arrows


/ Published in: Python
Save to your folder(s)

I was just asked how I did this
http://www.vimeo.com/clip:218013
so here goes ...


Copy this code and paste it in your HTML
  1. import math
  2.  
  3. width, height = 400, 300
  4.  
  5. size(width, height)
  6. speed(8)
  7.  
  8. def setup():
  9. global frame
  10. frame = 1
  11. global dots
  12. dots = [[50*x + 25, 50*y + 25, (y - x)*10.0] for x in xrange(8) for y in xrange(6)]
  13.  
  14. def stepDots():
  15. global dots
  16. for d in dots:
  17. d[2] += (d[0] + d[1])*0.01
  18.  
  19. def draw():
  20. global frame
  21. global distort
  22. global dots
  23.  
  24. stepDots()
  25. nofill()
  26. strokewidth(5)
  27. colormode(HSB)
  28. for d in dots:
  29. push()
  30. rotate(d[2])
  31. h = math.sin(math.radians(d[2])/5.0)*20.0
  32. stroke(math.sin(h)*0.1 + (math.sin(frame/48.0)*0.4 + 0.5), 0.7, 0.5, 1 - abs(h/15.0))
  33. scale(h/1.3)
  34. #rect(d[0], d[1], 10, 10)
  35. arrow(d[0], d[1], 20)
  36. pop()
  37.  
  38. frame += 1

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.