We are about to switch to a new forum software. Until then we have removed the registration on this forum.
The forms rotate nicely around the upper left and under right corner, but I can't get other forms to rotate around the under left corner. Instead of rotating around that corner, it made the range bigger and rotated around the upper left corner. I hope it is clear now and that someone can help me. I tried to do that at line 23-25.
float theta;
int i = 0;
void setup() {
size(750, 750);
background (130);
frameRate(60);
smooth();
}
void draw() {
if (i < 72) {
translate(width-40, height-50); // right under corner
rotate (theta);
drawShapes(); // all the shapes, written at void drawShapes
rotate (-theta);
translate(-width+40, -height+50); // left upper corner
rotate (theta);
drawShapes(); // all the shapes, written at void drawShapes
translate(0, height-50); // left under corner
rotate(theta);
drawOthers(); // all the shapes, written at void drawOthers
theta += radians(5); // rotation
i++;
}
}
void drawShapes() {
noStroke();
fill(#C347FA); // all kinds of forms and fills
ellipse(20, 30, 20, 20);
stroke(#47FACE);
line(25, 56, 36, 75);
line (36, 75, 18, 103);
noStroke();
fill(#47DDFA);
triangle(25, 125, 42, 145, 18, 170);
stroke(#FF0527);
line(45, 175, 6, 200);
line ( 6, 200, 55, 225);
noStroke();
fill(#FFFF98);
ellipse( 20, 250, 20, 20);
stroke(#D598FF);
line( 45, 275, 6, 300);
line ( 6, 300, 55, 325);
noStroke();
fill (#63B267);
triangle(25, 350, 42, 370, 18, 395);
stroke(#08B9FC);
line(25, 415, 36, 425);
line(36, 425, 18, 435);
noStroke();
fill(#FF79BC);
ellipse(20, 480, 20, 20);
}
void drawOthers () { // more kinds of forms and fills
fill(#FA0A0A);
ellipse(10, 10, 10, 10);
}
Answers
Please read this: https://forum.processing.org/two/discussion/15473/readme-how-to-format-code-and-text
Please also include exactly what you mean when you say it doesn't work. What exactly do you expect this code to do? What exactly does it do instead? How are those different? What line does that difference start?
I think this code would benefit from pushMatrix / popMatrix to isolate all the transformations.