Advertisement
Guest User

Untitled

a guest
Apr 5th, 2022
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. //// Some noise stuff by Stefan Petrick
  2. //// written in Processing 4, meant to be used with FastLED
  3.  
  4. void setup() {
  5. fullScreen();
  6. //size(820, 820);
  7. background(0);
  8. }
  9.  
  10. float scale = 10; // the zoom factor for the layers
  11. float scale2 = 5;
  12. float c, d, time;
  13. float shift1, shift2;
  14. float r, g, b;
  15.  
  16. int num_x = 16;
  17. int num_y = 16;
  18. int rct = 50;
  19. int sz = 40;
  20.  
  21. void draw() {
  22.  
  23. time = millis(); // lets have the animation speed independent from the framerate
  24. time = time *3; // global speed setting, could also be time/5 or anything
  25. c = time / 3000; // speeds of the linear scrollings relative to global speed
  26. d = time / 7000;
  27.  
  28. for (int x = 0; x < num_x; x++) {
  29. for (int y = 0; y < num_y; y++) {
  30.  
  31. shift1 = g/2000;
  32. shift2 = r/1000;
  33.  
  34. r = noise( (x)/scale +shift1, (y/scale) + c +shift2+shift1);
  35. r = map(r, 0.3, 0.8, 0, 255);
  36.  
  37. g = noise( (x/scale) +shift2, (y/scale) + d );
  38. g = map(g, 0.3, 0.7, 0, 255);
  39.  
  40. b = noise( (x/scale2) + shift1, (y/scale2) + shift2 );
  41. b = map(b, 0.3, 0.7, 0, 255);
  42.  
  43.  
  44.  
  45. fill( (b*r) / 255, b-g, (b-r) * g/255 );
  46. rect( 20+x*20, 20+y*20, 20, 20);
  47.  
  48. fill( r*y/15, 0, (g-b/2)*y/15);
  49. rect( 400+x*20, 20+y*20, 20, 20);
  50.  
  51. fill( r, g, 0 );
  52. rect( 840+x*10, 200+y*10, 10, 10);
  53.  
  54. fill( 0, g, b );
  55. rect( 1040+x*10, 200+y*10, 10, 10);
  56.  
  57. fill( r, 0, b );
  58. rect( 1240+x*10, 200+y*10, 10, 10);
  59.  
  60. fill( r-b, 0, 0 );
  61. rect( 840+x*10, 400+y*10, 10, 10);
  62.  
  63. fill( 0, g-b, 0 );
  64. rect( 1040+x*10, 400+y*10, 10, 10);
  65.  
  66. fill( 0, 0, b-r );
  67. rect( 1240+x*10, 400+y*10, 10, 10);
  68.  
  69. fill( r*(b/255), 0, 0 );
  70. rect( 840+x*10, 600+y*10, 10, 10);
  71.  
  72. fill( r*(b/255), g*r/255, 0 );
  73. rect( 1040+x*10, 600+y*10, 10, 10);
  74.  
  75. fill( r, g, b );
  76. rect( 1240+x*10, 600+y*10, 10, 10);
  77.  
  78. fill(r, 0, 0);
  79. rect(840+x*10, y*10, 10, 10);
  80.  
  81. fill(0, g, 0);
  82. rect(1040+x*10, y*10, 10, 10);
  83.  
  84. fill(0, 0, b);
  85. rect(1240+x*10, y*10, 10, 10);
  86. }
  87. }
  88. updatePixels();
  89. }
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement