IAT265 Spiral Animation Example.docx

2 Pages
Unlock Document

Interactive Arts & Tech
IAT 265
Matt Lockyer

Spiral Animation float xPos, yPos, dTheta, amplitude, rotation, objectSize; void setup() { size(500, 500); smooth(); objectSize = 20; // inialize the object size; in this case, the diameter xPos = objectSize/2; // move the object on screen to start yPos = height/2; dTheta = PI/200; // angular velocity, or the small amount added to rotation each frame amplitude = 100; } void draw() { background(255); // clear the background by setting it to white each frame // move the object to the center pushMatrix(); translate(width/2, height/2); drawObject(xPos, yPos, rotation + PI/2, objectSize); // draw the object on screen popMatrix(); xPos = amplitude * cos(rotation); yPos = amplitude * sin(rotation); /** Change the value of amplitude each frame to get a spiral. Increasing amplitude, spiral will grow outwards Descreasing amplitude means spiral will shrink. Don't forget to test for zero and stop the increment. A negative amp
More Less

Related notes for IAT 265

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.