fractalkitty looking for math? fractalkitty.com

early works

littusMoire

#trig#interactive#animation#math#spiral#polar

thetaoldXoldY

let a,r,theta;
let oldX=400,oldY=400;
let nx=[];
let ny=[];
n=1;
function setup(){
  createCanvas(windowWidth,windowHeight)
  angleMode(DEGREES)
  a=400
  nx[0]=0
  ny[0]=0
  stroke(255)
}
function draw(){
  background(0,0,0,5)
  translate(width/2,height/2)
  r=sin(frameCount/40)
  theta = a/(r*r)
  w=min(width,height)/4
  x=w*r*sin(theta+90);
  y=w*r*cos(theta+90);
  if(frameCount>2){
    for (let i=0;i<nx.length;i++){
      push()
      translate(nx[i],ny[i])
        line(x,y,oldX,oldY)
        line(-x,-y,-oldX,-oldY)
      pop()
    }
    
  }
}

function mousePressed(){
  nx[n]= mouseX-width/2
  ny[n] = mouseY-height/2

  n++
}