/* Grows tentacles one at a time, from the center of the window. Fading effect gives a "burnt" look to the oldest tentacles. I really like the army green background with the Maoist red of the new tentacles! A movie with frames created at the completion of every tentacle can be recorded by setting recordMovie to true */ boolean recordMovie = false; // whether to record a timelapse of the growing tentacle mass String savePath = "./frames/"; boolean slowFade = true; int startRad = 20; float x; float y; float curLength; float lengthVelocity; float waveIncrementer; float waveIncrementerAmount; float curSize; float sizeVelocity; float curRed; float redVelocity; float curGreen; float greenVelocity; float curBlue; float blueVelocity; float bgGreen = .2; float bgRed = 0.09; float bgBlue = 0.004; float newAngle = 0.0; float oldAngle; boolean stopRecord = false; void setup(){ size(800, 800); smooth(); colorMode(RGB, 1.0, 1.0, 1.0); background(bgRed, bgGreen, bgBlue); frameRate(100); String pathHome = System.getProperty("user.home"); println(pathHome); background(255, 255, 255); reset(); } void draw(){ // fade shifts... if(slowFade) { if(frameCount%100 == 0){ bgRed = random(0.0, 0.4); bgBlue = random(0.0, 0.2); } if(frameCount%10 == 0){ fill(bgRed, bgGreen, bgBlue, 0.01); rect(0, 0, width, height); } } else { // nothin' } // center and rotate frame... translate(width/2, height/2); rotate(newAngle); // use some perlin noise with the sin for some natural waviness... float curX = x + noise(waveIncrementer*.1) * 20 + sin(waveIncrementer) * 10; y = y + noise(waveIncrementer*.5) * 10 + sin(waveIncrementer) * 3; //y -= lengthVelocity; // draw the shape... stroke(0, bgGreen, 0, 70); fill(curRed, curGreen, curBlue); ellipse(curX, y, curSize, curSize); // increment properties... curLength -= lengthVelocity; curSize -= sizeVelocity; if(curGreen > bgGreen){ curGreen -= greenVelocity; } curRed -= redVelocity; curBlue -= blueVelocity; waveIncrementer += waveIncrementerAmount; // start next tentacle... if( curSize <= 5 ){ reset(); } } void reset(){ // place tentacle in center x = 0; y = 0; // speed... curLength = 0; lengthVelocity = random(1,3); curSize = 40; sizeVelocity = random(.4, 1.2); // waviness... waveIncrementer = random( 0, 2*PI ); waveIncrementerAmount = random(.2, .6); // initiate color... curRed = random(.7, 1); redVelocity = random( .005, .01 ); curGreen = random(0, .25); greenVelocity = .5 * redVelocity; curBlue = curGreen; blueVelocity = greenVelocity; // get new angle... oldAngle = newAngle; newAngle = oldAngle + random(PI/8, PI/4); //println(newAngle); } void keyPressed() { switch(key) { case 's': if(stopRecord) stopRecord = false; else stopRecord = true; break; } }