ethompsy
Resume and CV

Copyright 2008

80's Fun Time

import processing.core.*;
import processing.xml.*;

import java.applet.*;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.MouseEvent;
import java.awt.event.KeyEvent;
import java.awt.event.FocusEvent;
import java.awt.Image;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
import java.util.regex.*;

public class waves extends PApplet {


float time = 0;
float dis,xDis,yDis;
float xStart,yStart,xEnd,yEnd,xMid,yMid;
float xNois,yNois;
public void setup() {
background(255);
size(400, 500);
smooth();
noStroke();
frameRate(30);
//strokeWeight(10);

}

public void draw() {

xStart = width/2;
yStart = 0;
xEnd = width/2;
yEnd = height;
xDis = norm(abs(xEnd-xStart),0,width);
yDis = norm(abs(yEnd-yStart),0,height);
dis = norm(dist(xStart, yStart, xEnd, yEnd),-1000,1000)*300;

background(19,232,43);
fill(2,11,250);

beginShape();
curveVertex(xStart, yStart); // control point (first)
curveVertex(xStart, yStart); // point of curve (first)

int count = 10;
count++;
for (float j=1.0f; j<=count; j+=0.25f) {
for (float i=1.0f; i<=count; i+=2) {
float step = i/count;

xMid = lerp(xStart, xEnd,step);
yMid = lerp(yStart, yEnd,step);

float smoothing = step;

xNois= ((cos(time+i*.2f +j/2)*2)-1)*dis*yDis*smoothing*j + atan(time*i+j+1);
println("xNois = "+xNois);
yNois= ((cos(time+j*.2f +i/2)*2)-1)*dis*smoothing;
println("yNois = "+yNois);
strokeWeight(0.01f);
//fill(25+(xNois*0.01),75+yNois,50);
curveVertex(xMid+xNois, yMid+yNois); //mid control point
//ellipse(xMid+xNois, yMid+yNois, 10, 10);
}
}
curveVertex(xEnd, yEnd); // point of curve (last)
curveVertex(xEnd, yEnd); // control point (last)
endShape();

fill(250,2,242);

beginShape();
curveVertex(xStart, yStart); // control point (first)
curveVertex(xStart, yStart); // point of curve (first)

int count2 = 5;
count2++;
for (float j=1.0f; j<=count2; j+=0.25f) {
for (float i=1.0f; i<=count2; i+=2) {
float step = i/count2;

yMid = lerp(xStart, xEnd,step);
xMid = lerp(yStart, yEnd,step);

float smoothing = step;

yNois= ((cos(time+i*.2f +j/2)*2)-1)*dis*yDis*smoothing*j + atan(time*i+j+1);
println("xNois = "+xNois);
xNois= ((cos(time+j*.2f +i/2)*2)-1)*dis*smoothing;
println("yNois = "+yNois);
strokeWeight(0.01f);
//fill(25+(xNois*0.01),75+yNois,50);
curveVertex(xMid+xNois, yMid+yNois); //mid control point
//ellipse(xMid+xNois, yMid+yNois, 10, 10);
}
}
curveVertex(xEnd, yEnd); // point of curve (last)
curveVertex(xEnd, yEnd); // control point (last)
endShape();

time+=(.005f*(mouseX-200));
}
static public void main(String args[]) {
PApplet.main(new String[] { "--bgcolor=#FFFFFF", "waves" });
}
}