fractalkitty looking for math? fractalkitty.com

100 days of code

floralVertigo

#animation

circleG

let n = 10;
function setup(){
  createCanvas(windowWidth,windowHeight)
  background(0,0,0,10);
  noStroke();
  fill(255,255,255);
  angleMode(DEGREES);
}

function draw(){
  background(0);
  translate(width/2,height/2);
  t=frameCount/10;
  for(let i=5;i>=0;i--){
    push()
      if (i%2==0){
        p=0
        q=255;
        k=1
      }
      if (i%2==1){
        p=255
        q=0;
        k=1
      }
    scale(i/3,i/3)
    translate(0,-height/(i*0.6))
      circleG(p,q,k)
    pop()
  }
}

function circleG(p,q){
  fill(p)
  circle(0,height/2,width/5)
  for(let i=0;i<n;i++){
    push()
    translate(0,height/2);
    rotate(360/n*i+k*t);
    fill(p)
    ellipse(0,width/8,width/12,width/12)
    pop()
  }
}