int border = 30; int counter = 0; int nextnode = 0; float step = 3.0; float drift = 4.0; int dotsize = 15; int nodes = 635; float xsize = 900; float ysize = 450; float[] setx = new float[nodes]; float[] sety = new float[nodes]; color[] setc = new color[nodes]; float csize = 5; float r = random(128) + 128; float rup = 1; float g = random(128) + 128; float gup = 1.5; float b = random(128) + 128; float bup = 2; void setup() { background(0); size(900, 450); for (counter = 0; counter < nodes; counter = counter + 1) { setx[counter] = random(xsize); sety[counter] = random(ysize); r = r + rup * random(csize); if (r > 255) rup = -rup; if (r < 0) rup = -rup; g = g + gup * random(csize); if (g > 255) gup = -gup; if (g < 0) gup = -gup; b = b + bup * random(csize); if (b > 255) bup = -bup; if (b < 0) bup = -bup; setc[counter] = color(r, g, b); } } void draw() { // if (mousePressed) { // fill(0); // } else { // fill(255); // } // ellipse(mouseX, mouseY, 80, 80); noStroke(); if (nodes < 1000) { for (counter = 0; counter < nodes; counter = counter + 1) { fill (0); ellipse (setx[counter], sety[counter], dotsize, dotsize); } } else { background(0); } for (counter = 0; counter < nodes; counter = counter + 1) { nextnode = (counter + 1) % nodes; if (setx[counter] < setx[nextnode]) { setx[counter] = setx[counter] + step; } else { setx[counter] = setx[counter] - step; }; if (sety[counter] < sety[nextnode]) { sety[counter] = sety[counter] + step; } else { sety[counter] = sety[counter] - step; }; setx[counter] = setx[counter] + drift; if (setx[counter] < 0) setx[counter] = xsize; if (setx[counter] > (xsize - (border * 2))) { setx[counter] = 0; sety[counter] = random(ysize)+ 0.25; } if (sety[counter] < border) sety[counter] = (ysize - border); if (sety[counter] > (ysize - border)) sety[counter] = border; fill (setc[counter]); ellipse (setx[counter], sety[counter], dotsize, dotsize); } }