I have created a spiral of rectangles. Now, I want those rectangles to spin in their respective places. How do I go about it? I have attached the code here:
< // import the library
import com.hamoid.*;
// create a new VideoExport-object
VideoExport videoExport;
int nbr_circles = 100;
float angle_incr = radians(2);
int r = 0;
int fspeed = 1;
Hey @tabreturn - thank you…
Yes, I have tried that inside the for loops and also outside them but they are going out of the frame and forming a vinyl disc feel (which in itself is cool though)…but I want them spinning in place…can you please let me know where to add those?
//Places rectangle at (x,y)
stroke(255, 0, 0);
rect(x, y, sm_diameter, sm_diameter);
//Translates rectangle at (0,0) to (x,y)
//Rotates rectangle; uncomment different combinations to see what this does
push();
//rotate(angle);
translate(x, y);
translate(10,10); //Shift it over to see the red rectangle!
//rotate(angle);
stroke(0, 255, 0);
rect(0, 0, sm_diameter, sm_diameter);
pop();
}
I commented the rotate()'s in the above code.
Uncomment them (try different combinations) to see what happens.
Explore the tutorials, references and examples to understand transformations.