Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
void setup()
{
  size(400, 400);
  frameRate(60);
  rectMode(CENTER);
  noStroke();
}

void draw()
{
  frameRate(60);
  
  //background for ocean
  background(90, 158, 175);

  //bubble 1
  fill(50, 103, 126, 80);
  ellipse(60, frameCount % 450, 50, 50);
  fill(90, 158, 175, 150);
  ellipse(60, (frameCount - 15) % 450, 20, 10);

  //back left tentical
  stroke(92, 56, 77);
  strokeWeight(66);
  beginShape();
  curveVertex(160, 120);
  curveVertex(160, 120);
  curveVertex(140, 85);
  curveVertex(145, 35);
  curveVertex(150, 0);
  curveVertex(150, 0);
  endShape();
  stroke(123, 75, 103);
  strokeWeight(60);
  beginShape();
  curveVertex(160, 120);
  curveVertex(160, 120);
  curveVertex(140, 85);
  curveVertex(145, 35);
  curveVertex(150, 0);
  curveVertex(150, 0);
  endShape();

  //front left tentical
  noFill();
  stroke(92, 56, 77);
  strokeWeight(66);
  beginShape();
  curveVertex(130, 370);
  curveVertex(130, 370);
  curveVertex(65, 380);
  curveVertex(10, 350);
  curveVertex(-10, 300);
  curveVertex(0, 220);
  curveVertex(20, 160);
  curveVertex(35, 100);
  curveVertex(25, 40);
  curveVertex(10, 0);
  curveVertex(10, 0);
  endShape();
  stroke(123, 75, 103);
  strokeWeight(60);
  beginShape();
  curveVertex(130, 370);
  curveVertex(130, 370);
  curveVertex(65, 380);
  curveVertex(10, 350);
  curveVertex(-10, 300);
  curveVertex(0, 220);
  curveVertex(20, 160);
  curveVertex(35, 100);
  curveVertex(25, 40);
  curveVertex(10, 0);
  curveVertex(10, 0);
  endShape();

  //back right tentical
  stroke(92, 56, 77);
  strokeWeight(66);
  beginShape();
  curveVertex(290, 330);
  curveVertex(290, 330);
  curveVertex(340, 310);
  curveVertex(365, 260);
  curveVertex(360, 185);
  curveVertex(320, 115);
  curveVertex(335, 40);
  curveVertex(360, 0);
  curveVertex(360, 0);
  endShape();
  stroke(123, 75, 103);
  strokeWeight(60);
  beginShape();
  curveVertex(290, 330);
  curveVertex(290, 330);
  curveVertex(340, 310);
  curveVertex(365, 260);
  curveVertex(360, 185);
  curveVertex(320, 115);
  curveVertex(335, 40);
  curveVertex(360, 0);
  curveVertex(360, 0);
  endShape();

  //front right tentical
  stroke(92, 56, 77);
  strokeWeight(66);
  beginShape();
  curveVertex(280, 380);
  curveVertex(280, 380);
  curveVertex(330, 385);
  curveVertex(380, 350);
  curveVertex(405, 260);
  curveVertex(400, 190);
  curveVertex(375, 120);
  curveVertex(300, 60);
  curveVertex(300, 60);
  endShape();
  stroke(123, 75, 103);
  strokeWeight(60);
  beginShape();
  curveVertex(280, 380);
  curveVertex(280, 380);
  curveVertex(330, 385);
  curveVertex(380, 350);
  curveVertex(405, 260);
  curveVertex(400, 190);
  curveVertex(375, 120);
  curveVertex(300, 60);
  curveVertex(300, 60);
  endShape();

  //octopus head
  stroke(92, 56, 77);
  strokeWeight(4);
  fill(123, 75, 103);
  ellipse(200, 260, 220, 360);
  stroke(202, 149, 152, 80);
  strokeWeight(50);
  beginShape();
  curveVertex(200, 120);
  curveVertex(200, 120);
  curveVertex(175, 135);
  curveVertex(157, 152);
  curveVertex(145, 175);
  curveVertex(135, 215);
  curveVertex(135, 215);
  endShape();

  //left eye
  stroke(0);
  strokeWeight(2);
  beginShape();
  curveVertex(150, 280); 
  curveVertex(150, 280);
  curveVertex(140, 270);
  curveVertex(120, 275);
  curveVertex(115, 290);
  curveVertex(120, 320);
  curveVertex(130, 340);
  curveVertex(145, 345);
  curveVertex(155, 340);
  curveVertex(160, 320);
  curveVertex(160, 320);
  endShape();
  noStroke();
  fill(0);
  ellipse(140, 300, 10, 20);
  noFill();
  stroke(0);
  strokeWeight(2);
  beginShape();
  curveVertex(155, 260);
  curveVertex(130, 230);
  curveVertex(110, 240);
  curveVertex(130, 270);
  endShape();

  //line(155, 245, 170, 270);

  //right eye
  stroke(0);
  noFill();
  strokeWeight(2);
  beginShape();
  curveVertex(250, 280); 
  curveVertex(250, 280);
  curveVertex(260, 270);
  curveVertex(280, 275);
  curveVertex(285, 290);
  curveVertex(280, 320);
  curveVertex(270, 340);
  curveVertex(255, 345);
  curveVertex(245, 340);
  curveVertex(240, 320);
  curveVertex(240, 320);
  endShape();
  noStroke();
  fill(0);
  ellipse(260, 300, 10, 20);
  noFill();
  stroke(0);
  strokeWeight(2);
  beginShape();
  curveVertex(245, 260);
  curveVertex(270, 230);
  curveVertex(290, 240);
  curveVertex(270, 270);
  endShape();

  //line(245, 245, 230, 270);

  //bubble 3
  noStroke();
  fill(50, 103, 126, 80);
  ellipse(100, (frameCount * .6) % 450, 75, 75);
  fill(90, 158, 175, 150);
  ellipse(100, ((frameCount * .6)-20) % 450, 30, 15);

  //bubble 2
  fill(50, 103, 126, 80);
  ellipse(320, (frameCount * .7) % 450, 100, 100);
  fill(90, 158, 175, 150);
  ellipse(320, ((frameCount * .7)-25) % 450, 40, 20);

  //bubble 4
  fill(50, 103, 126, 80);
  ellipse(410, (frameCount * .2) % 450, 60, 60);
  fill(90, 158, 175, 150);
  ellipse(410, ((frameCount * .2)-15) % 450, 30, 15);

  //bubble 5
  fill(50, 103, 126, 80);
  ellipse(200, (frameCount * .8) % 450, 50, 50);
  fill(90, 158, 175, 150);
  ellipse(200, ((frameCount * .8) - 15) % 450, 20, 10);

  //bubble 6
  fill(50, 103, 126, 80);
  ellipse(0, (frameCount * .5) % 450, 100, 100);
  fill(90, 158, 175, 150);
  ellipse(0, ((frameCount * .5)-25) % 450, 40, 20);

  //bubble 7
  fill(50, 103, 126, 80);
  ellipse(250, (frameCount * .3) % 450, 75, 75);
  fill(90, 158, 175, 150);
  ellipse(250, ((frameCount * .3)-20) % 450, 30, 15);

  //top layer for ocean - fading
  fill(0, 155, 188, mouseY/3);
  rect(200, 200, 400, 400);
}


void mousePressed()
{
  frameRate(1);
  
  //background for ocean
  background(90, 158, 175);

  //bubble 1
  fill(50, 103, 126, 80);
  ellipse(60, frameCount % 450, 50, 50);
  fill(90, 158, 175, 150);
  ellipse(60, (frameCount - 15) % 450, 20, 10);

  //back left tentical
  stroke(92, 56, 77);
  strokeWeight(66);
  beginShape();
  curveVertex(160, 120);
  curveVertex(160, 120);
  curveVertex(140, 85);
  curveVertex(145, 35);
  curveVertex(150, 0);
  curveVertex(150, 0);
  endShape();
  stroke(123, 75, 103);
  strokeWeight(60);
  beginShape();
  curveVertex(160, 120);
  curveVertex(160, 120);
  curveVertex(140, 85);
  curveVertex(145, 35);
  curveVertex(150, 0);
  curveVertex(150, 0);
  endShape();

  //front left tentical
  noFill();
  stroke(92, 56, 77);
  strokeWeight(66);
  beginShape();
  curveVertex(130, 370);
  curveVertex(130, 370);
  curveVertex(65, 380);
  curveVertex(10, 350);
  curveVertex(-10, 300);
  curveVertex(0, 220);
  curveVertex(20, 160);
  curveVertex(35, 100);
  curveVertex(25, 40);
  curveVertex(10, 0);
  curveVertex(10, 0);
  endShape();
  stroke(123, 75, 103);
  strokeWeight(60);
  beginShape();
  curveVertex(130, 370);
  curveVertex(130, 370);
  curveVertex(65, 380);
  curveVertex(10, 350);
  curveVertex(-10, 300);
  curveVertex(0, 220);
  curveVertex(20, 160);
  curveVertex(35, 100);
  curveVertex(25, 40);
  curveVertex(10, 0);
  curveVertex(10, 0);
  endShape();

  //back right tentical
  stroke(92, 56, 77);
  strokeWeight(66);
  beginShape();
  curveVertex(290, 330);
  curveVertex(290, 330);
  curveVertex(340, 310);
  curveVertex(365, 260);
  curveVertex(360, 185);
  curveVertex(320, 115);
  curveVertex(335, 40);
  curveVertex(360, 0);
  curveVertex(360, 0);
  endShape();
  stroke(123, 75, 103);
  strokeWeight(60);
  beginShape();
  curveVertex(290, 330);
  curveVertex(290, 330);
  curveVertex(340, 310);
  curveVertex(365, 260);
  curveVertex(360, 185);
  curveVertex(320, 115);
  curveVertex(335, 40);
  curveVertex(360, 0);
  curveVertex(360, 0);
  endShape();

  //front right tentical
  stroke(92, 56, 77);
  strokeWeight(66);
  beginShape();
  curveVertex(280, 380);
  curveVertex(280, 380);
  curveVertex(330, 385);
  curveVertex(380, 350);
  curveVertex(405, 260);
  curveVertex(400, 190);
  curveVertex(375, 120);
  curveVertex(300, 60);
  curveVertex(300, 60);
  endShape();
  stroke(123, 75, 103);
  strokeWeight(60);
  beginShape();
  curveVertex(280, 380);
  curveVertex(280, 380);
  curveVertex(330, 385);
  curveVertex(380, 350);
  curveVertex(405, 260);
  curveVertex(400, 190);
  curveVertex(375, 120);
  curveVertex(300, 60);
  curveVertex(300, 60);
  endShape();

  //octopus head
  stroke(92, 56, 77);
  strokeWeight(4);
  fill(123, 75, 103);
  ellipse(200, 260, 220, 360);
  stroke(202, 149, 152, 80);
  strokeWeight(50);
  beginShape();
  curveVertex(200, 120);
  curveVertex(200, 120);
  curveVertex(175, 135);
  curveVertex(157, 152);
  curveVertex(145, 175);
  curveVertex(135, 215);
  curveVertex(135, 215);
  endShape();

  //left eye
  stroke(0);
  strokeWeight(2);
  beginShape();
  curveVertex(150, 280); 
  curveVertex(150, 280);
  curveVertex(140, 270);
  curveVertex(120, 275);
  curveVertex(115, 290);
  curveVertex(120, 320);
  curveVertex(130, 340);
  curveVertex(145, 345);
  curveVertex(155, 340);
  curveVertex(160, 320);
  curveVertex(160, 320);
  endShape();
  noStroke();
  fill(0);
  ellipse(140, 300, 10, 20);
  noFill();
  stroke(0);
  strokeWeight(2);
  line(155, 245, 170, 270);

  //right eye
  stroke(0);
  noFill();
  strokeWeight(2);
  beginShape();
  curveVertex(250, 280); 
  curveVertex(250, 280);
  curveVertex(260, 270);
  curveVertex(280, 275);
  curveVertex(285, 290);
  curveVertex(280, 320);
  curveVertex(270, 340);
  curveVertex(255, 345);
  curveVertex(245, 340);
  curveVertex(240, 320);
  curveVertex(240, 320);
  endShape();
  noStroke();
  fill(0);
  ellipse(260, 300, 10, 20);
  noFill();
  frameRate(1);
  stroke(0);
  strokeWeight(2);
  line(245, 245, 230, 270);

  //bubble 3
  noStroke();
  fill(50, 103, 126, 80);
  ellipse(100, (frameCount * .6) % 450, 75, 75);
  fill(90, 158, 175, 150);
  ellipse(100, ((frameCount * .6)-20) % 450, 30, 15);

  //bubble 2
  fill(50, 103, 126, 80);
  ellipse(320, (frameCount * .7) % 450, 100, 100);
  fill(90, 158, 175, 150);
  ellipse(320, ((frameCount * .7)-25) % 450, 40, 20);

  //bubble 4
  fill(50, 103, 126, 80);
  ellipse(410, (frameCount * .2) % 450, 60, 60);
  fill(90, 158, 175, 150);
  ellipse(410, ((frameCount * .2)-15) % 450, 30, 15);

  //bubble 5
  fill(50, 103, 126, 80);
  ellipse(200, (frameCount * .8) % 450, 50, 50);
  fill(90, 158, 175, 150);
  ellipse(200, ((frameCount * .8) - 15) % 450, 20, 10);

  //bubble 6
  fill(50, 103, 126, 80);
  ellipse(0, (frameCount * .5) % 450, 100, 100);
  fill(90, 158, 175, 150);
  ellipse(0, ((frameCount * .5)-25) % 450, 40, 20);

  //bubble 7
  fill(50, 103, 126, 80);
  ellipse(250, (frameCount * .3) % 450, 75, 75);
  fill(90, 158, 175, 150);
  ellipse(250, ((frameCount * .3)-20) % 450, 30, 15);

  //top layer for ocean - fading
  fill(0, 155, 188, mouseY/3);
  rect(200, 200, 400, 400);
}