fractalkitty looking for math? fractalkitty.com

100 days of code

binarySpiral_Day7

#random#trig#3d#animation#accumulates#spiral

let x=0,y=0,r = 200,a=0,b=1;
function setup() {
  createCanvas(500, 500,WEBGL);
  angleMode(DEGREES)
  fill(00,0,5)
  plane(500,500)
  stroke(255)
}

function draw() {
  strokeWeight(0.2)
  r = r*0.995
  x = r*cos(b*frameCount*2+a);
  y = r*sin(b*frameCount*2+a);
  push()
    translate(x,y,0)
    sphere(r,24,24)
  pop()
  push()
    translate(-x,-y,0)
    sphere(r,24,24)
  pop()
  if (r<3){
    fill(0);
    strokeWeight(0.01);
    plane(width,width)
    r = random(50,400);
    a = random(0,360);
    b = random(-5,5);
  }
}