Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. float xincr, yincr, dst;
  2.  
  3. void setup() {
  4.   //size(600, 600);
  5.   fullScreen();
  6.   background(60);
  7.   dst = height/5.5;
  8.   strokeWeight(2);
  9. }
  10.  
  11. void draw() {
  12.   fill(0);//40
  13.   rect(0, 0, width, height);
  14.  
  15.   translate(width/2, height/2);
  16.   xincr += 0.01;
  17.   yincr += 0.005;
  18.   float yincr2 = yincr;
  19.   for (float y = -dst; y <= dst; y += 3) {
  20.     yincr2 += 0.01;
  21.     float xincr2 = xincr;
  22.     for (float x = -dst; x <= dst; x += 3) {
  23.       xincr2 += 0.01;
  24.       drawSquare(x, y, noise(xincr2*(mouseX-width/2)/2000, yincr2*(mouseY-height/2)/2000));
  25.     }
  26.   }
  27. }
  28.  
  29. void drawSquare(float x, float y, float noiseFactor) {
  30.   stroke(0, 175);
  31.   if (noiseFactor * 450 > 255) fill(255);
  32.   else fill(noiseFactor * 450);
  33.   rect(x * noiseFactor * 4, y * noiseFactor * 4, 5, 5);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement