fractalkitty looking for math? fractalkitty.com

Coded Poems

Mathober day-11: Quadratic

#random#image#animation#accumulates#poem#mathober


let bg
let r = 30;
let p,k,h
let m

function preload() {
  
  bg = loadImage("/assets/quad.jpg");
  star = loadImage("/assets/star.png")
  
}

function setup() {
  createCanvas(600,600);
  angleMode(DEGREES)
  noStroke()
   background(bg)
   h = 0
  p = 1
  k = 0
  
}

function draw() {
  t = (frameCount*10)%width ;
   translate(width/2,height/2);
    x = -width/2 + t%width+randomGaussian(0,100);
    y = (-(x-h)*(x-h)/(4*p)+k)
  fill(255)
    tmp = randomGaussian(1,20)
      image(star,x-tmp/2,y-tmp/2,tmp,tmp)
  if (t<4){
    p = randomGaussian(0,100)
    k = 0
  }
}