fractalkitty looking for math? fractalkitty.com

100 days of code

Static_Day2

#random#image#animation

cnty

let cnt = 100,dx = 1,dy=1;
let cnty = 0;
function preload() {
  bg = loadImage('/assets/Enlight48.jpg');
}
function setup() {
  cnv = createCanvas(bg.width/7, bg.height/7);//canvas creation
  noStroke();  
  cnty=height;
  background(bg);
}
function draw() {
  for(i=0;i<width;i=i+dx){    
    let x = i;
    let y = cnty;
    pix = bg.get(bg.width/(width/x),bg.height/(height/y));
    fill(pix[0]+random(-50,50),pix[1]+random(-50,50),pix[2]+random(-50,50),200);
    tmpx = random(0,50);
    tmpy = random(3,500);
    rect(x,y,tmpx,tmpy);
  }
  cnty = cnty+dy;
  if (cnty>height){
    background(bg);
    if (cnty >height+60){
      cnty = 0;
    }
  }
}