/*Assingment 4 Shane Banner This program is basically a random screensaver in a way. I took the spiral and boucing ball and sin codes and combined them to make a program that looks like a fingerprint scanner overtime*/ //We start by defining our variables// float yPos=0; float time = 0; float angle = 0.0; float radius = 1.0; int deg = 0; float increment=random(20); //Make our viod setup void setup() { //Good visable size size(600,600); //no stroke makes it more fun looking noStroke(); smooth(); ellipseMode(CENTER); } //Now a void draw void draw() { //Some more variables for the spiral float angle = radians(deg); float x = width/2 + (cos(angle) * radius); float y = height/2 + (sin(angle) * radius); fill(random(255),random(255),random(255)); //The ellipse is our shape going in a spiral ellipse(x, y, 6, 6); deg += 11; if(radius>width/2+1) { radius=0; increment=random(20); } //We increase the radius to create a spiraling outward effect radius = radius + 0.34; yPos = height/2 +(height/2.5)*sin(angle); fill(50); //This ellipse is the bouncing ball ellipse(time, yPos, 6, 6); if (time>width) { time=0; } time += 5; //And add PI/50 to the angle to make the ball move angle += PI/50.0; //This last chunk will be the scanner like movement. for (int p = 0; p <= width; p += 5) { //Some variable for the waves float y1 = height/2 + (sin(angle) * height/3); float y2 = height/2 + (cos(angle) * height/3); //Lets make wave one green! fill(0,255,0); //The first wave rect(p, y1, 2, 4); //The second wave can be blue fill(0,0,255); //The second wave rect(p, y2, 2, 4); //Now we add PI/20 to the angle to make it move angle += PI/20.0; } }