Rotating a square around another rotating square
in
Programming Questions
•
8 months ago
Hello, this is my code so far.
int rotationOne = 0;
void setup(){
size (800,600);
background(255);
noStroke();
smooth();
println(values.length);
}
void draw(){
for (int i=0; i< words.length;i++){
pushMatrix();
rotationOne+=1;
translate(width/2, height/2);
rotate(radians(rotationOne));
rectMode(CENTER);
background(255);
rect(0,0,100,100);
fill(0);
popMatrix();
}
}
Currently there is one rectangle rotating around the center of the screen. What I was attempting was to draw a second rectangle to rotate next to the first. However, when I do this, the square seems to be rapidly moving from the left to the right side of the screen around the original rectangle.
Any help is greatly appreciated.
Maxwell
int rotationOne = 0;
void setup(){
size (800,600);
background(255);
noStroke();
smooth();
println(values.length);
}
void draw(){
for (int i=0; i< words.length;i++){
pushMatrix();
rotationOne+=1;
translate(width/2, height/2);
rotate(radians(rotationOne));
rectMode(CENTER);
background(255);
rect(0,0,100,100);
fill(0);
popMatrix();
}
}
Currently there is one rectangle rotating around the center of the screen. What I was attempting was to draw a second rectangle to rotate next to the first. However, when I do this, the square seems to be rapidly moving from the left to the right side of the screen around the original rectangle.
Any help is greatly appreciated.
Maxwell
1