// written by sharp hall // sharph.net int sqrX = 0; int sqrY = 0; color sqrC; float opac = 0; float velX = 0; float x = 0; float velY = 0; float y = 0; int lastRand = 0; void setup() { size(700,400); background(0); frameRate(15); } void draw() { smooth(); // square section if(frameCount % 5 == 1) { sqrX = int(random(width-100)); sqrY = int(random(height-100)); sqrC = color(random(0,60),random(30,80),random(80,120),40); } noSmooth(); noStroke(); fill(sqrC); rect(sqrX,sqrY,100,100); // paint section smooth(); strokeWeight(random(30)); if(mousePressed) { stroke(random(255),random(255),random(255),200); line(mouseX,mouseY,pmouseX,pmouseY); velX = mouseX - pmouseX; velY = mouseY - pmouseY; x = mouseX; y = mouseY; opac = 200; lastRand = frameCount; } else if(opac > 2) { stroke(random(255),random(255),random(255),opac*=0.90); line(x,y,x+=int(random(velX*3)),y+=int(random(velY*3))); } if(frameCount - lastRand > 35) { lastRand = frameCount; x = int(random(width)); y = int(random(height)); velX = random(-8,8); velY = random(-8,8); opac = 255; } }