I was trying to make a circle rotate around the center of the window using sin() and cos(). I later found a similar
example in the Processing website. I know I can use rotate() to get the same effect, but using trig functions you can make the circle travel in an elliptical fashion. Any way I can't figure out why this won't work:
//declare variables:
float ang = 0.0;
float x;
float y;
void setup() {
size(400, 400);
}
void draw() {
background(0);
//set coordinates of the circle:
float x = cos(ang)*100;
float y = sin (ang)*100;
//translate to the middle of the screen:
translate(width/2, height/2);
//draw the circle:
fill(255, 75);
ellipse(x, y, 20, 20);
//increment ang by 0.02
ang =+ 0.02;
}
It is very similiar to the example in the Processing website, can anyone tell me why this won't work?