Advertisement
Guest User

tiddies

a guest
Oct 9th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. int n=500;
  2. int x[]=new int[n];
  3. int y[]=new int[n];
  4. int velocidad[]=new int[n];
  5. int diameter[]=new int[n];
  6. color bola[]=new color[n];
  7.  
  8. void setup() {
  9. size(800, 600);
  10. for (int i=0; i<n; i++) {
  11. x[i]=(int)random(width);
  12. y[i]=(int)random(height);
  13. velocidad[i]=(int)random(-20,20);
  14. diameter[i]=(int)random(30,150);
  15. bola[i]=color(random(255),random(255),random(255),random(50,255));
  16.  
  17. }
  18. noStroke();
  19. smooth();
  20. }
  21.  
  22. void bolita(int x, int y, color bola, float diameter) {
  23. fill(bola);
  24. ellipse(x, y, diameter, diameter);
  25. }
  26.  
  27. void draw() {
  28. background(0);
  29. for (int i=0; i<n; i++) {
  30. bolita(x[i], y[i], bola[i], diameter[i]);
  31. x[i]+=velocidad[i];
  32. if (x[i]>width | x[i]<0) {
  33. velocidad[i]=-velocidad[i];
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement