Rotating a spiral using Framerate

Hi all!
I was wanting to rotate this spiral (made of ellipses) using framerate or some other means so the whole image slowly rotates.

Any help or direction towards tutorials, similar questions etc would be helpful!

Thanks

void setup() {
  size(600, 600);
  background(#FFFF52); // yellow
  stroke(0);  //black
  fill(#3CCAF0); //blue
  rotate(PI/4);
 
}
 
void draw() {
  translate(width / 2, height / 2); //centre the canvas
  float angle = TWO_PI / 21.0;
  for (float rad = 20.0 ; rad < 500.0;) { //spread of the circles using radians
    float s = TWO_PI * rad / 50.0;  // size of circle
    for(int i = 0 ; i < 21 ; i++) { // 21 circles
      ellipse(rad, rad, s, s); // x & y co-ordinates changes depending on radians
      rotate(angle);
    }
    rotate(angle * .25);  // spacing between circles or offset
    rad += .25 * s; 
  }
  noLoop();
}
1 Like

Example:

float th;

void setup() 
  {
  size(600, 600, P3D);
  noStroke();
  }
 
void draw() 
  {
  background(255, 255, 0);
  lights();
  translate(width/2, height/2); //centre the canvas 
  rotateX(th);
  rotateY(th);
  fill(255, 0, 0);
  box(3*10, 3*40, 3*90); 
  th+=TAU/500;
  }

You can adapt this to your 2D sketch.

References:
https://processing.org/tutorials/p3d/
https://processing.org/tutorials/transform2d/
https://processing.org/reference/rotate_.html

:slight_smile:

2 Likes