fractalkitty looking for math? fractalkitty.com

100 days of code

hexWave

#trig#animation#math#geometry#wave

polygonangle

function setup(){
  createCanvas(600,600)
}
function draw(){
  r=30
  background(0);
  stroke(255)
  translate(width/2,width/2)
  for (let j=0;j<20;j++){
    
    for (let i=100;i>0;i--){
     fill(200+i+j,150+i*j,100+i+j,150);
      
      x=-width/2+r*j*1.5;
      y=-width/2+-r*12+r*sqrt(3)*i+r*j/1.15;
      noStroke()
      circle(x,y,2*r+r-i*5-r*3*sin(frameCount/100))
      noFill()
      strokeWeight(1.5)
      stroke(200,150,100)
    polygon(x,y,1.5*r-2*i,6);
      noFill()
  }
}
}
function polygon(x, y, radius, npoints) {
  let angle = TWO_PI / npoints;
  beginShape();
  for (let a = 0; a < TWO_PI; a += angle) {
    let sx = x + cos(a) * radius;
    let sy = y + sin(a) * radius;
    vertex(sx, sy);
  }
  endShape(CLOSE);
}