fractalkitty looking for math? fractalkitty.com

early works

SQevenodd

#random#animation#accumulates#math

strokenewPoly

var cnt =-12;//x-value and counter for each polynomial
var a=1,t=0,tmp =1,x1=-12,y1= -12;//initialize variables
function setup() {
  createCanvas(400, 400);
  background(255);
  strokeWeight(0.4);//thin lines
  fill(255,40);//transparent fill
}

function draw() {
  translate(width/2,width/2)
  push();
  rotate(t);//rotate canvas with each polynomial
  oldx = x1;//save previous x
  oldy = y1;//save previous y
  x1 = cnt;
  y1 = (a*pow((x1),tmp))
  if(y1>-200 && y1 <200){
    if ((tmp % 2 )== 0){//condition for even function
        stroke(230,100,20);//color for even
    }
    if ((tmp % 2 )== 1){//condition for odd function
        stroke(20,60,90);//color for odd
    }
    line(x1*15,y1,oldx*15,oldy)
    circle(x1*15,y1,x1*10)//draw a circle for a points on the polynomial
    }
    cnt=cnt+0.2;
    if (cnt>12){//condition to draw the next polynomial
      newPoly();// function to change coefficients
    }
  pop()
}
function newPoly(){
  a = random(-5,5)//change a
  cnt = -12;//reset cnt
  t = t+1;
  x1=-12,y1= -12
  tmp=round(random(1,5));
}