Study Guides (380,000)
CA (150,000)
SFU (4,000)
IAT (70)
IAT 265 (10)
Final

# IAT 265 Study Guide - Final Guide: Angular Velocity, Ellipse

Department
Interactive Arts & Tech
Course Code
IAT 265
Professor
Matt Lockyer
Study Guide
Final

This preview shows half of the first page. to view the full 2 pages of the document.
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
amplitude will cause the sprial to reverse
***/
rotation += dTheta; // change to dTheta to a negative to go the opposite direction
amplitude += 0.1;
fill(56);
textAlign(RIGHT);
text("xPos: " + xPos, width - 5, 20);
text("yPos: " + yPos, width - 5, 40);
text("angle: " + rotation, width- 5, 60);
}
/**