void setup(){ size (600,600); color (RGB/255); frameRate(120); smooth(); background(0,0,50); } void draw(){ float bG = mouseY; float d = dist( width/2, height/2, mouseX, mouseY); float mxb = mouseX+random(-width/2,width/2); float myb = mouseY+random(-height/2,height/2); fill(0,0,50, d/2); rect(0,0,width, height); fill(255,255,255, d*4); noStroke(); star4(random(width),random(height),random(4)); println (d); } void arrow (float qx, float qy, float qs1, float qs2){ // Narrow arrow; x position, y position, size value 1, size value 1, **qs1 usually bigger than qs2** quad(qx, qy, qx+qs1, qy-qs2, qx+qs2, qy, qx+qs1, qy+qs2); } void star4 (float s4x, float s4y, float s4s){ // 4 line star; x position, y position, size, rotation // rotate(PI/s4r); beginShape(); vertex(s4x, s4y+s4s); vertex(s4x+2*s4s, s4y); vertex(s4x+3*s4s, s4y-2*s4s); vertex(s4x+4*s4s, s4y); vertex(s4x+6*s4s, s4y+s4s); vertex(s4x+4*s4s, s4y+2*s4s); vertex(s4x+3*s4s, s4y+4*s4s); vertex(s4x+2*s4s, s4y+2*s4s); vertex(s4x, s4y+s4s); endShape(); } void star5 (float sx, float sy, float ss){ // 5 line star; x position, y position, size beginShape(); vertex(sx, sy); vertex(sx+3*ss, sy+7*ss); vertex(sx+11*ss, sy+8*ss); vertex(sx+6*ss, sy+14*ss); vertex(sx+7*ss, sy+21*ss); vertex(sx, sy+18*ss); vertex(sx-7*ss, sy+21*ss); vertex(sx-6*ss, sy+14*ss); vertex(sx-11*ss, sy+8*ss); vertex(sx-3*ss, sy+7*ss); endShape(CLOSE); } void mousePressed() { if( mouseButton == LEFT){ background(0,0,50); } } void keyPressed(){ // save frame if(keyPressed) { if (key == 's' || key == 'S') { saveFrame("image-####.png"); } } }