fractalkitty looking for math? fractalkitty.com

weekly creative coding

looking up

#random#interactive#wcc


let a,b,c,d;
function setup(){
  createCanvas(windowWidth*0.8, windowHeight*0.8)
  noLoop()
  a = floor(random(5,22));
  b= random(1,4);
  c= random(30,width/2)
  d = random(30,400)
}
function draw(){
  translate(width/2,height/2)
  noStroke()
 for (let i=0;i<width;i++){
    push()
	 	let v=map(i,0,width,0,180)
    fill(v/2+c,v/2*b+b*10,a+v/2*c/100)
    rotate(TWO_PI/a*i)
    circle(0,0,width*1.2-i)
    pop()
  }
  stroke(0)
  noFill()
  strokeWeight(5);
  for (let i=0;i<a;i++){
    push()
    rotate(TWO_PI/a*i)
    ellipse(c/2,0,b*120,c)
    ellipse(10,0,a*3,d)
    pop()
  }
  for (let i=0;i<a*2;i++){
    push()
    rotate(TWO_PI/(a*2)*i)
    ellipse(c,0,d,d*2)
    ellipse(c+d,0,b*100,1200-d)
    pop()
  }
  
}

function mousePressed(){
  setup()
  draw()
}

function windowResized(){
  resizeCanvas(windowWidth*0.8, windowHeight*0.8)
}