/* Devin Fairchild October 09, 2009 Processing This program is an attempt to create the illusion of water. It is a crude abstract visualization at best, because water is incredibly difficult to replicate. The illusion is created by moving ellipses along sine or cosine waves to create gyrating movement similar to that of water. */ void setup() { size(640, 480); colorMode(RGB); } float wave = 0.0; //Used to manipulate the wavelength of the sine/cosine function void draw() { PImage img; //Setup for image parameters size (640, 480); background(0); for (int xMove = 0; xMove <= height; xMove += 10) { //For statement that will control the lateral movement of the sine/cosine waves; xMove for the x coordinate movement of the waves float sine = height/5 + (sin(wave) * height); //Parameters for the sine wave that will control the movement of the blue ellipses float cosine = height/5 + (cos(wave) * height); //Parameters for the cosine wave img= loadImage("water.jpg"); //Determines which image is loaded noStroke(); fill(int (random(100,200)), int (random(100, 200)) ,255, 100); //Random fill restricting to bluish colors ellipse(xMove,sine,200,50); //A sine string of ellipses to create the illusion of movement fill(int (random(100,200)), int (random(100, 200)) ,255, 100); //Random fill restricting to bluish colors ellipse(xMove,cosine,200,50); //A cosine string of ellipses to create the illusion of movement //tint(150,150,150,200); //image(img, xMove, sine); //tint(150,150,150,200); //image(img, xMove, cosine); tint(150,150,150,150); //Creates a cosine string of tall ellipses to partiallly frame the other strings image(img, 0, 0); //Loads the image wave += PI/20.0; //Controls the wavelength of the sine/cosine waves } }