fractalkitty looking for math? fractalkitty.com

100 days of code

eclipticRipples

#trig#interactive#animation#math#wave

cTogether

let n=9;
function setup(){
  createCanvas(windowWidth,windowHeight);
  stroke(255);
  noFill();
  angleMode(DEGREES);
  strokeWeight(0.1)
}
function draw(){
  background(0);
  translate(width/2,height/2);
  t = frameCount/2
  push()
    rotate(t)
    for(let i=0;i<n;i++){
      cTogether(width/11,0,i*(360/n),6-2*cos(t));
    }
    for(let i=0;i<n;i++){
      cTogether(width/4,0,i*(360/n),2+3*sin(t));
    }
  pop()
  push()
    rotate(-t)
    for(let i=0;i<n;i++){
      cTogether(width/6,0,i*(360/n),3+3*sin(t));
    }
  pop()
  push()
    fill(0)
    noStroke();
    fill(0,0,0,435-435*sin(t/5))
    circle(width/2*sin(t/2-180),height/2-height/2*cos(t/2-180),width/1.8)
  pop()
}
function cTogether(x,y,r,s){
  push()
  rotate(r);
  translate(x,y);
  for(let i=0;i<200;i++){
    circle(0,0,width/(s+0.3*(i*1.2)));
  }
  pop()
}
function mousePressed(){
  if (n<20){
    n=n+1;
  }
  if (n>=20){
    n=1;
  }
}