fractalkitty looking for math? fractalkitty.com

early works

portHole

#random#trig#interactive#animation#wave#sea

ampArray1tentaclesBoolportHoleBoolwavesportHoletentacles

let ampArray1 = [];
let t;
let tentaclesBool = true;
let portHoleBool=true;
function setup() {
  createCanvas(windowWidth, windowHeight);
  angleMode(DEGREES);
  col=int(random(0,50));
  seed=random(0,1)*10000000;
  amp=int(random(10,30));
}

function draw() {
  noStroke();
  translate(width/2,height/2);
  background(255);
  maxAmp = amp;
  t=frameCount/5;  
  waves();
  noFill();
  if (tentaclesBool){
    tentacles();}
  if (portHoleBool){
    noStroke();
    portHole();}

}
function waves(){
  fill(9+col, 100+col, 160+col,90);
  beginShape()
    for (let i=-width/2; i <= width/2; i=i+ 10) {
      y = 10*sin(t*amp+i/3)-3*cos(t*20+4*i)+12*sin(t+amp+i)-90;
      vertex(i,y+col); 
  }
  vertex(width, height);
  vertex(-width, height);
  endShape(CLOSE);
  fill(60+col, 80+col, 140+col,90)
  beginShape()
    for (let i=-width/2; i <= width/2; i=i+ 10) {
      y = 12*sin(frameCount+i*2-t/10)*cos(t)-11*cos(frameCount-i)-50+5*sin(frameCount +i/2)-1*cos(frameCount+4*i);
      vertex(i,y+col) 
  }
  vertex(width, height);
  vertex(-width, height);
  endShape(CLOSE);
  fill(30+col, 50+col, 110+col,90)
  beginShape()
    for (let i=-width/2; i <= width/2; i=i+ 10) {
      y = 10*sin(t*10+i)-15*cos(t*10-i)-30+amp/2*cos(t*2 +i)-1*cos(t*10+4*i);
      vertex(i,y+col) 
  }
  vertex(width, height);
  vertex(-width, height);
  endShape(CLOSE);
  fill(col, 30+col, col+80,140)
  beginShape()
    for (let i=-width/2; i <= width/2; i=i+ 10) {
      y = 10*cos(frameCount+i/2)-10+5*sin(frameCount-i)*cos(t)+-+3*sin(frameCount +i);
      vertex(i,y+col) 
  }
  vertex(width, height);
  vertex(-width, height);
  endShape(CLOSE);
}
function portHole(){
  fill(255)
  r=min(width,height)/3
  beginShape()
    for (let i=0; i <= 180; i++) {
      x = r*cos(i);
      y = r*sin(i);
      vertex(x,y); 
  }
  vertex(-width,0)
  vertex(-width, height);
  vertex(width, height);
  vertex(width,0)
  endShape(CLOSE);
  beginShape()
    for (let i=179; i <= 361; i++) {
      x = r*cos(i);
      y = r*sin(i);
      vertex(x,y) ;
  }
  vertex(width,0)
  vertex(width, -height);
  vertex(-width, -height);
  vertex(-width,0);
  endShape(CLOSE);
  stroke(4, col, col+50);
  strokeWeight(1);
  noFill();
  circle(0,0,2*r+50);
}
function tentacles(){
   beginShape()
  for(let i=0;i<220;i+=0.5){
    x=-width/2 *cos(i/2+seed)*sin(i/4-seed)-width/2*cos(i+t)*sin(t)+i;
    y=-i*2+height - 10*amp*cos(i/(col+1))*sin(i/9)-amp/2*cos(i/2)*cos(i)*sin(t)+height/3*cos(i/2+t);
    vertex(x,y);
    if(i%5===0){
      strokeWeight(10)
      stroke(100+col,50,50,120);
      circle(x-10,y-10,2);
      circle(x+10,y+10,2);
      stroke(255)
      strokeWeight(2)
      circle(x-10,y-10,1);
      circle(x+10,y+10,1);
      strokeWeight(50);
      stroke(100+col,50,50,120);
    }
  }
  endShape()
  beginShape()
  for(let i=0;i<220;i+=0.5){
    x=-width/2 *sin(i/2+t)*sin(i/2-t/(col/5+1))-width/3*cos(i/2+t/amp);
    y=-i*2+height/2 - 10*amp*cos(i/2)*sin(i/3)-amp*cos(i/2+t)*cos(i*2+t)*sin(t-seed)+height/1.5*cos(i/2)*sin(i*col/50)*cos(i/2+t)+height/6;
    vertex(x,y);
    if(i%5===0){
      strokeWeight(10)
      stroke(100+col,50,50,120);
      circle(x-10,y-10,2);
      circle(x+10,y+10,2);
      stroke(255)
      strokeWeight(2)
      circle(x-10,y-10,1);
      circle(x+10,y+10,1);
      strokeWeight(50);
      stroke(100+col,50,50,120);
    }
  }
  endShape()
  
}

function keyPressed(){
  if(keyCode===84){
    tentaclesBool=!tentaclesBool;
    frameCount=0;
  }
  if(keyCode===80){
    portHoleBool=!portHoleBool;
  }
}