Software für das Zusammenfassen und Projizieren auf Leinwand mehrerer Netzkunstarbeiten (REUPLOAD der Repository von ende 2019)
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

stars.pde 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. int rate = 7;
  2. int tickMS = rate;
  3. int previous_stars = 0;
  4. int time_stars = 0;
  5. int rate2 = 1800;
  6. int tickMS2 = rate;
  7. int previous_stars2 = 0;
  8. int time_stars2 = 0;
  9. int starRadius = 20;
  10. Star stars[] = new Star[1000];
  11. Star stars2[] = new Star[1000];
  12. void paintStars() {
  13. int current = millis();
  14. int elapsed = current - previous_stars;
  15. previous_stars = current;
  16. time_stars += elapsed;
  17. while(time_stars >= tickMS){
  18. time_stars -= tickMS;
  19. stars[(int)random(stars.length)].go();
  20. tickMS = int(random(rate/100,2*rate-(rate/100)));
  21. }
  22. if (stars.length > 0) {
  23. for (int i = stars.length-1; i > 0; i--) {
  24. if(stars[i].alive){
  25. stars[i].display();
  26. }
  27. }
  28. }
  29. }
  30. void paintStars2() {
  31. int current = millis();
  32. int elapsed = current - previous_stars2;
  33. previous_stars2 = current;
  34. time_stars2 += elapsed;
  35. while(time_stars2 >= tickMS2){
  36. time_stars2 -= tickMS2;
  37. stars2[(int)random(stars.length)].go();
  38. tickMS2 = int(random(rate2/100,2*rate2-(rate/100)));
  39. }
  40. if (stars2.length > 0) {
  41. for (int i = stars2.length-1; i > 0; i--) {
  42. if(stars2[i].alive){
  43. stars2[i].display();
  44. }
  45. }
  46. }
  47. }
  48. class Star {
  49. int x, y, init;
  50. int radius, bjitter, b;
  51. int lifetime = 3600;
  52. boolean alive;
  53. PGraphics pg;
  54. Star(PGraphics pg_) {
  55. pg = pg_;
  56. }
  57. void go(){
  58. alive = true;
  59. x = (int)random(0,270);
  60. y = (int)random(0,270);
  61. init = millis();
  62. b = 255;
  63. bjitter = (int)random(-50, 50);
  64. radius = starRadius;
  65. }
  66. void display() {
  67. b -= 10;
  68. pg.fill(255, b);
  69. pg.ellipse(x, y, radius, radius);
  70. radius -= .5;
  71. if (init + lifetime < millis()) {
  72. alive = false;
  73. }
  74. }
  75. }