// Viral Expansion 2x // by John Clavin float R1, G1, B1; float R2, G2, B2; color levelColor1; color levelColor2; int pF = 6; // powerFactor float xPos; float yPos; void setup() { size(700, 500); background(240); stroke(0); smooth(); frameRate(.25); } void draw() { setColor(); background(240); explode(width/2, height/2, 15); } void explode(float x, float y, int level) { R1 += .0075; G1 -= .0075; levelColor1 = color(R1, G1, B1); R2 += .0075; G2 += .0065; B2 -= .0075; levelColor2 = color(R2, G2, B2); xPos = x + int(random(-pF, pF)); yPos = y + int(random(-pF, pF)); ellipse(xPos, yPos, 6, 6); if(level > 1) { level--; fill(levelColor1); explode(xPos, yPos, level); fill(levelColor2); explode(xPos, yPos, level); } } void setColor() { R1 = 0; G1 = 255; B1 = 0; R2 = 0; G2 = 0; B2 = 240; }