Assignment-3 Floating Bubbles

Concept

The assignment was to create a generative artwork using Object-Oriented Programming in p5.js. So for this assignment I wanted to create a bubble generator, such that when a button is pressed, random bubbles generates and floats into different directions.

Inspiration

Acrylic Bubble Wall Aquarium, Packaging Type: Box at best price in Noida

I got inspired by watching a Bubble Wall aquarium. It’s like a magical glass tank where bubbles pop up randomly, creating a beautiful display. So, I wanted to recreate that magic digitally by making bubbles appear randomly on the screen when you press a button.

A highlight of some code that you’re particularly proud of

function mouseClicked() {
  
  // Check if mouse click is within the box
  
  if (mouseX > width / 2 - 50 && mouseX < width / 2 + 50 && mouseY > height - 50 && mouseY < height) {
    
    // Add multiple bubbles to the array
    
    for (let i = 0; i < 50; i++) {
      
      //initialize
      let x = random(width);
      let y = height;
      let speedX = random(-5, 5);
      let speedY = random(-10, -5);
      let col = color(random(255), random(255), random(255));
      let size = random(20,60);
      
      //push it to the array
      bubbles.push(new Bubble(x, y, speedX, speedY, col, size));
    }
  }

Embedded sketch

Reflection and ideas for future work or improvements

For future improvements I want to add more life to the aquarium by adding fishes, plants etc. which will contain interactive elements in them

 

Leave a Reply