Midterm Project – The Pearl Dive

THE Concept

The Pearl Dive was inspired by my love for the ocean and my interest in Emirati culture and history. I wanted to create a playful, game-like experience that would also teach players about the UAE’s economy before the discovery of oil, when pearl diving was an important source of income for many families. The game begins with a welcome screen featuring an Arabic greeting, followed by an instructions screen that explains how to play. The main game shows a traditional boat above the ocean, with a nahham (the traditional ship singer) represented on the boat. Ocean sounds and traditional chants play during the game to create a more immersive experience and reflect the cultural role of music in motivating divers and sailors. The player controls an underwater diver using the arrow keys to move around the ocean and collect clams. The diver and clam images, animated waves, sun, clouds and seabed make my underwater environment. Three clams appear in random positions and regenerate every two to three seconds. Each time the diver touches a clam, the score increases and after collecting six clams, the game transitions to the pearl screen. Here, the player clicks on each of the six clams to reveal a randomly generated pearl with a specific colour, size and value. I created five possible pearl colours including blue, purple, pink, green and white each with a different base value. The size of the pearl also affects its value with larger pearls receiving more points. The values are then added together to calculate the total value of all six pearls in millions of AED. This makes the pearl auction interactive because the player does not know what each clam contains until they open it. My goal was to combine game mechanics to make a traditional pearl-diving industry while highlighting its importance in Emirati history and culture.

How the Game Works

The game consists of three main screens: the start screen, the instructions screen and the main game, followed by the pearl screen.

Start Screen: The game begins with a welcome screen displaying “السلام عليكم” and “Welcome to The Pearl Dive.” The player clicks the yellow “Press to start” button to move to the instructions screen.

Instructions Screen: This screen explains how to play the game. The player reads the instructions and clicks the button to begin diving. Once the game starts, the ocean sounds and traditional chants begin playing.

Main Game Screen: The player controls the diver using the arrow keys to move left, right, up and down underwater. The objective is to collect six clams by moving the diver into them. Three clams appear at a time in random positions and regenerate every two to three seconds. The score at the top left increases whenever the diver collects a clam. The background features a traditional dhow boat, animated ocean waves, a sun, clouds and the seabed. A nahham, the traditional ship singer, is also shown on the boat, accompanied by music notes and traditional chants. Once the player collects six clams, the game automatically moves to the pearl screen.

Pearl Screen: The six collected clams appear in two rows of three. The player clicks each clam to reveal a randomly generated pearl. Each pearl has a colour, size and value. There are five possible colours: blue, purple, pink, green and white, each with a different base value. The pearl’s size also affects its value, with larger pearls receiving more points. The colour points and size points are added together to calculate the pearl’s value in millions of AED. Each clam can only be opened once, and the player can see the value of each pearl underneath it. After all six clams have been opened, the total value of all the pearls is displayed at the bottom of the screen. The player can then click the “Return” button to return to the start screen and play again.

PLAY GAME!!

Code I Am Proud Of

There were quite a few aspects of the game that I found difficult to implement, but with the help of references and experimentation, I managed to bring my ideas to life and create a game that I am proud of. The three parts I am most proud of are the moving waves, the collision detection and the random pearl generation.

1.Moving Waves and the Animated Ocean

function drawWave(offset, speed, phase, amp, c) {
  // sin() makes the smooth up and down, t makes it move
  const waveY = (x) =>
    surfaceY + offset + sin(x * 0.02 + t * speed + phase) * amp;

  stroke(30, 80, 130);
  strokeWeight(3);
  fill(c);

  // go along the top of the wave, then down and back to close the shape
  beginShape();
  vertex(0, floorY);

  for (let x = 0; x <= width; x += 6) {
    vertex(x, waveY(x));
  }

  vertex(width, floorY);
  endShape(CLOSE);
}

I did not want the ocean to stay still so I wanted to mimic how waves move in the ocean. I used mathematical functions to create waves that move up and down instead of using a video or a moving image. The sin() function creates the wave shape while the variable t changes over time to animate it. I also used different speeds, offsets and phases to create layers of waves. This was challenging because I had to understand how the sine function works and how to connect points to create a filled shape rather than just a line.

2. Detecting Collisions Between the Diver and the Clams

function checkClamCollisions() {
  // if the diver is closer than this to a clam, it counts as a touch
  const hitDist = diverH / 2.5 + clamH / 2;

  // we go backwards so removing a clam does not mess up the loop
  for (let i = clams.length - 1; i >= 0; i--) {
    if (dist(diverX, diverY, clams[i].x, clams[i].y) < hitDist) {
      clams.splice(i, 1);
      score++;

      // 6 clams means it is time to open them
      if (score >= 6) {
        startPearlScreen();
        return;
      }
    }
  }
}

I am proud of how I made the diver collect clams by moving into them, which made my project an actual game rather than just an animation. The dist() function calculates the distance between the diver and each clam. When the diver gets close enough, the clam disappears and the score increases. Once the player collects six clams the game moves onto the pearl screen. This was challenging because I had to remove clams from a list while looping through it. I solved this by counting backwards in the loop so that removing an item would not cause the code to skip another clam.

3. Random Pearl Generation and Calculating Pearl Values

function openPearl(i) {
  const c = pearlClams[i];

  // a clam can only be opened once
  if (c.opened) return;
  c.opened = true;

  // pick a random colour and a random size
  const shade = random(pearlColors);
  const size = Math.floor(random(15, 201));

  // bigger pearls give more points
  const sizePoints = size >= 150 ? 5 : size >= 100 ? 4 : size >= 50 ? 3 : 2;
  const value = shade.points + sizePoints;

  collectedPearls[i] = {
    size: size,
    color: shade.name,
    rgb: shade.color,
    value: value
  };

I am proud of this feature because it adds an element of surprise to the game and connects it to the historical importance of pearl diving in the UAE. When the player clicks a clam, the game randomly generates a pearl with a colour and size. Each colour has a different point value, and the pearl’s size adds more points depending on its range. The values are then added together to calculate the total value of the collected pearls. This was the most challenging part because I had to combine random values, arrays, objects, conditional statements and calculations. I also had to ensure that each clam could only be opened once to prevent the player from repeatedly increasing the total by clicking the same clam.

Development Process and Challenges

One of my biggest challenges was deciding how to end the game and make the user feel accomplished after collecting all six clams. At first, I wanted to create a pearl auction with all the pearls the user collected but as I developed the game I realised that my code was already too long with all the aesthetic features I wanted to include. I then came up with the idea of randomly generating pearls with different colours, sizes and values, allowing the user to open each clam and discover how much their pearls were worth. I decided that showing the total value would be a simpler and more satisfying ending. This helped me keep the game interactive while giving the user a clear sense of achievement without adding too many extra features. 

I also had a hard time finding a audio recording of a traditional UAE chant that had enough volume and clear sound to work well in the game. I wanted the audio to fit the UAE pearl diving theme and make the experience feel more authentic. Finding the right sound took some time but it was important to me because I wanted the game to feel connected to the culture and history I was representing.

Reflection and Future Improvements

This project took a really long time to complete because I wanted to include many details and aesthetic features to make the game more interesting. Looking back I could have shown Emirati traditions in many other ways if I had more time. I could have explored more creative ideas and added features that gave the user a deeper understanding of the history and culture of pearl diving in the UAE. For future improvements, I would like to make the game more interactive and include more creative ways to represent traditional life, such as adding more activities, stories or cultural details. 

References and AI Usage

Sine Function and Moving Waves

I used the p5.js reference for the sin() function to help create the moving waves in the ocean.

Code! Programming with p5.js for Beginners by The Coding Train

I frequently referred back to this series, especially the videos about while loops, for loops, conditionals and classes. These videos were extremely helpful when understanding the concepts and retracing errors in my code.

Random Pearl Generation: I used the p5.js reference for the random() function to help generate random pearl colours and sizes. https://p5js.org/reference/p5/random/

Audio: For the audio features, I used the class notes available on GitHub to help implement the ocean sounds and traditional chant.

Mouse Interaction: I referred to The Coding Train’s tutorial on mouse interaction to help implement clicking on buttons and opening the clams. https://thecodingtrain.com/tracks/code-programming-with-p5-js/code/7-arrays/4-mouse-interaction

Waves and Other Visual Features:I used this tutorial as a reference for creating the waves and other visual elements in the game. https://youtu.be/Fbzqfsy5GnM?si=Tc5C07y_HyG6XCOR

AI Usage: I used ChatGPT a little to help me understand and fix errors in my code. It was also useful for creating the moving waves using the sin() function and helping me generate a list of pearl colours with different point values then apply them randomly when the player opens each clam. It also suggested adding a helper function at the end of my code to check whether the mouse is inside a button or rectangle which made the mouse interaction easier to manage.

I also used Google Gemini to help generate the diver and instructions-page graphics based on my sketches. Since the graphics were AI-generated, some details may not be completely accurate or finished.

Week 5 – Reading Response

Computer vision is different from human vision because computers do not actually “see” images the way humans do. A computer sees an image as pixels and needs algorithms to figure out what those pixels mean. Humans can understand objects, movement, and situations much more naturally, while computer vision usually needs specific conditions and instructions to recognize something.

There are different techniques we can use to help a computer see or track what we are interested in. Some examples are frame differencing, background subtraction, and brightness thresholding. Frame differencing can detect movement by comparing two frames, while background subtraction can separate people or objects from the background. Brightness thresholding can also help detect objects when there is a strong difference in brightness between them and their surroundings.

Computer vision’s ability to track people also connects to surveillance, which can make interactive art more complicated. I think it can be interesting because artists can use tracking to make an artwork react to people, but it also raises questions about privacy and how much people are being watched without realizing it. One artwork I found interesting was Sorting Daemon by David Rokeby. I like it because there is a lot happening in the composite image. The system watches people outside, detects them, separates their images from the background and organizes parts of them by color and size. I think it is interesting because it turns something that feels like surveillance into an artistic image while also making us think about how technology can automatically analyze and categorize people.

Week 5 – Midterm Progress

The concept

Coming into the midterm project, I had zero ideas about what I wanted to do. While looking for inspiration, I came across a Save the Ocean https://intro.nyuadim.com/2023/03/08/midterm-project-save-the-ocean-game/ game made by a prior student which really inspired me. I really liked the ocean aspect because one of my favourite games growing up was Sky Whale, and I felt like that resonated with me. I wanted to create something that had a playful, game-like feeling while also being connected to something I personally enjoy. I have always loved the ocean and the beach, and even my phone and iPad wallpapers are beaches so I knew I wanted my project to be underwater and ocean-oriented.

I then wanted to connect this idea to Emirati culture and the UAE’s history. I wanted my project to explore what the UAE’s economy looked like before oil, particularly the traditional pearl-diving industry. Before the discovery of oil, pearl diving was an important part of the region’s economy and supported many families. I wanted to show what this traditional activity was like and how difficult and humble the process was. Divers did not have the equipment that modern divers have today. They would spend months away from their families on pearl-diving boats, with some ships carrying around 100–120 people depending on their size. Divers could go down to depths of around 7–30 meters and had to navigate and understand the ocean without modern technology. The experience was also unpredictable because weather and sea conditions could change quickly making pearl diving extremely dangerous.

I also wanted to include some of the cultural elements surrounding pearl diving rather than focusing only on the diving itself. For example, the nahham or traditional ship singer, would sing and chant to motivate the divers and sailors, helping distract them from fatigue during the long journeys. I want to incorporate recordings or recreations of these traditional songs and chants into the game.

Start Screen and Instructions

The first sketch shows the starting screen of the game. It will be very simple and will say: “Salam Alaykum, Welcome to the Pearl Dive” The user will then press a Start button, which will take them to an instruction screen explaining how to play the game and what they need to do. After reading the instructions the player will enter the main game.

#1
 Main Game Interface

The second sketch shows the main game interface. At the top, there will be a pearl-diving boat, followed by the surface of the ocean. Underwater, there will be clams that the diver has to collect. The clams will regenerate every 2–3 seconds. This is meant to represent the unpredictability and difficulty of pearl diving. Conditions at sea could change quickly, with periods of strong wind or difficult weather making the dives more dangerous. I want to represent this difficulty through the randomness of the clam spawning rather than simply making the game progressively harder. The player will control the diver underneath the boat and will need to collect the clams before they run out of time underwater.

#2
Game Mechanics and Cultural Elements

On the boat, there will be a nahham, the traditional ship singer. He will sing traditional songs and chants to motivate the sailors and distract them from their fatigue. I am planning to look for recordings or examples of traditional nahham songs and potentially use an old recording or recreate the audio for the game. I also want to incorporate Islamic-inspired chants/nasheeds where appropriate. On the top right of the screen, there will be seven bubbles representing the seven emirates. Similar to the underwater timer in games like Minecraft, the bubbles will represent how long the diver can remain underwater. Each bubble will disappear after approximately five seconds. Next to the boat, there will be a “Pull Me Up” button. The player can press this button at any point to bring the diver back to the surface, but they must do so before all seven bubbles disappear. The diver himself will also reflect the traditional pearl-diving process. He will have a rope around his neck, a basket for collecting oysters, and a nose plug. He will then dive underwater to collect the clams. At the bottom right of the screen, there will be a clam counter showing the number of clams collected. The maximum will be six clams. Once the player collects all six, they will move on to the pearl auction.

Pearl Auction

Once the player collects all six clams, the game will transition to a Pearl Auction screen. The screen will have “Pearl Auction” as the title, with the six collected clams displayed underneath in a 3 × 2 layout. The instructions will tell the player: “Press on a clam to open it.” When the player clicks on a clam, it will randomly reveal the weight/size and colour of the pearl inside. The different pearl characteristics will determine its value. The pearl colours will include traditional and rarer variations such as pearly white, slightly pink and grey, with each colour having a different value. The weight of the pearl will also affect its price, with heavier pearls being more valuable. This will introduce a random element to the auction and show how the value of the pearls could vary.

#4

That’s my game so far as of now I don’t know what to do with the value of the pearls, As I’m trying to make the value of the pearl be an interactive element to the game!

For more knowledge on the history:

https://www.facebook.com/watch/?v=24292573663712195

صيد اللؤلؤ في الامارات

My Project so far

Most Frightening / Uncertain Part

The part of my project that I am most uncertain about is the pearl auction and how the value of each pearl will work as an interactive element. I know that I want the player to open each clam and receive a pearl with a randomly generated size, weight and colour, but I am still figuring out how these characteristics should affect the value of the pearl. I also want the auction to feel like an actual part of the game rather than just showing the player a random number. Another concern is making sure that the random generation feels balanced. If the valuable pearls appear too often, the game will become too easy, but if they are too rare, the player might feel like their score is based completely on luck. I therefore want to test different combinations of pearl colours, sizes and weights and see how they affect the final value.

What I Did to Reduce the Risk

To reduce this risk, I started testing the random generation of the pearls in p5.js. My goal is to have the game randomly generate the characteristics of each pearl when the player opens a clam. For example, the pearl could randomly receive a colour and a weight, and these two characteristics can then be used to calculate its value. I am testing the idea of giving each pearl colour a different base value and then adding to that value depending on the weight of the pearl. This gives me a simple system that I can adjust as I continue developing the game. I can also test the random results multiple times to make sure that different pearl values appear and that the player has a reasonable chance of getting both common and rare pearls. This is important because the pearl auction is one of the main interactive parts of my game. By testing the randomization and value calculation now, I can make sure that the system works before I build the rest of the auction interface around it.



Week 4 – Loading Data, Displaying text

The Concept

For this piece, I wanted to build something that felt more moving, with text that reacts to the viewer instead of just sitting there. One Arabic word appears in the center of the canvas, and when you click it, it “explodes” into two dozen flying copies of itself. Each copy moves in a random direction, shrinks, and fades out until the last one disappears. Then, a new word and background color appear, waiting for the next click. The words I used were سلام (peace), حب (love), أمل (hope), نور (light), فرح (joy), and حلم (dream). I chose these words because they are short, meaningful, and visually strong in Arabic script, which made them a good fit for a generative piece based on repetition and motion. For the font, I copied the P5 GS that we discussed in class, which showed an example of Arabic text. The Arabic font was already included in the file, so I used that part and added my own code to create the interaction and animation.

Highlight: The Code I’m Proud Of

The part of this sketch I’m happiest with is the Word class. Early drafts of this project tracked every flying copy using a pile of separate arrays, one for x position, one for y position, one for speed, one for size, one for transparency and so on and keeping all of them in sync by index got messy fast. Rewriting it as a class cleaned everything up so now each flying copy is a single self-contained object that knows its own position, speed, size and fade level and knows how to move and draw itself.

class Word {
  constructor(x, y, speedX, speedY, size, word) {
    this.x = x;
    this.y = y;
    this.speedX = speedX;
    this.speedY = speedY;
    this.size = size;
    this.alpha = 255;
    this.word = word;
  }

  move() {
    this.x = this.x + this.speedX;
    this.y = this.y + this.speedY;
    this.alpha = this.alpha - 2;
  }

  show() {
    textSize(this.size);
    fill(255, 255, 255, this.alpha);
    text(this.word, this.x, this.y);
  }

  isFinished() {
    return this.alpha <= 0;
  }
}
Embedded Sketch

How Was This Made

This sketch combines several things I learned in the first few weeks of class. I used arrays and objects to keep track of the words as they explode, similar to the Ball Class examples we worked on in class. I also made a Word class, using the same object-oriented programming idea from the Ball and Car class examples. I used random() to choose the word, background color, and different speeds and sizes for the copies. The mouseClicked() function makes the explosion happen when the canvas is clicked, and draw() continuously updates the position and fading of each word to create the animation. For the Arabic text, I used the Noto Kufi Arabic font from Google Fonts because Arabic needs to be displayed correctly with its connected letters. I followed the font method we discussed in class which uses HTML and CSS instead of loadFont().

Reflection and Future Ideas

I like how simple the idea is, but I think I could make it more interesting. I would like to add trails behind the words, allow multiple explosions at the same time, and make each word look different based on its meaning. I could also add a sound when the words explode if that works.

Week 4 – Creative Reading

Reading Don Norman made me think more critically about the projects we have done in class. In previous projects, we focused a lot on making something work, but Norman made me realize that something working does not always mean it is well designed. A user should not have to stop and think about what to click, press or do next. This connects to our own projects because even a simple interactive project can become confusing if the design does not clearly communicate how it works. I think this is something I sometimes overlook because I focus more on the code and the final result than on how another person experiences it.

Something everyday that annoys me a lot is my car doors. I have a Tesla, and the car doors are designed to be one with the door, which annoys me, especially as a commuter. I usually have a lot of things in my hands during long days, so opening the door requires a completely empty hand. One time, I had a bottle of water in my hand and wanted to open the door but I had just gotten a fresh manicure. My fresh manicure was ruined, and I had to go inside the salon to fix it. I ended up having to put the bottle on top of the car just so I could open the door.

What I found most interesting was Norman’s idea that designers should not blame users when something is confusing. It made me question how much responsibility we have as creators to make our projects understandable. For our previous class projects, we usually know how our own work functions because we made it, but a new user does not have that same knowledge. This makes me think that testing our projects with other people is just as important as creating them. Going forward I want to pay more attention to whether my projects are actually intuitive to someone who has never seen them before, instead of assuming that if I understand it, everyone else will too.

Week 3 – Object-Oriented Programming

Concept

For this artwork, I wanted to use the ball example that we did in class and talked about. I wanted to take the basic idea and make it more interactive by giving the user more ways to interact with the artwork. Basically, when the user presses the screen, a new ball is created at the position where they clicked. Each ball has its own different properties, such as its speed, size, gravity, bounce, and color. Because these properties are randomly generated, every ball is slightly different from the others. I also added another interaction where the user can press C to change the color of all the balls. This makes the artwork change even after the balls have already been created. I wanted the artwork to feel like something the user is creating themselves rather than something that is completely automatic.

References and Inspiration

I first got my idea from this video from The Coding Train: [LINK]. I liked the concept of creating and moving objects, and I wanted to use a similar idea but add more interactivity to it. I also used the W3Schools website to understand more about arrays and references and to learn about things that I could use to improve my Object-Oriented Programming: [LINK] [LINK].

Code
//array for balls
let balls = [];

function setup() {
  createCanvas(500, 500);
}

function draw() {
  background(240);
//some instructions
  fill(0, 0, 0, 40);
  textAlign(CENTER);
  textSize(16);
  text("Click the screen to create a ball!", 250, 30);
  textSize(10);
  text("Press C to change color", 250, 60);

  line(0, 450, 500, 450);

  // Update every ball in the array
  for (let ball of balls) {
    ball.update();
    ball.display();
  }
}


// Click the mouse to create a new ball
function mousePressed() {

  let newBall = new Ball(mouseX, mouseY);
  balls.push(newBall);

  console.log("New ball:", newBall.color, newBall.speed);
}


// Press C to change the color of all the balls
function keyPressed() {

  if (key == 'c' || key == 'C') {

    for (let ball of balls) {
      ball.changeColor();
    }
  }
}

//Ball Class
class Ball {

  constructor(x, y) {

  this.x = x;
  this.y = y;

  this.size = random(20, 60);
  this.speed = 0;

  this.gravity = random(0.1, 0.3);
  this.bounce = random(0.85, 0.95);

  this.color = color(
    random(255),
    random(255),
    random(255),
    128
  );
}
//updates the balls movements
  update() {

    this.speed = this.speed + this.gravity;
    this.y = this.y + this.speed;


    if (this.y + this.size / 2 >= 450) {

      this.y = 450 - this.size / 2;
      this.speed = -this.speed * this.bounce;
    }
  }

  display() {

    noStroke();

    fill(this.color);

    circle(this.x, this.y, this.size);
  }

  
  //change the color of the ball
  changeColor() {

    this.color = color(
      random(255),
      random(255),
      random(255),
      128
    );
  }
}
Embedded Sketch

Problems I Ran Into

One of the main things I had to figure out was how to make every ball have its own properties while still using the same Ball class. I solved this by giving each new ball random values for its size, gravity, bounce, speed, and color inside the constructor. I also had to figure out how to change the color of all the balls at the same time. Since all of the balls are stored inside an array, I used a loop to go through every ball and call the changeColor() function when the user presses C. Another part I had to understand was how the balls could keep updating and displaying themselves while being stored in the array. I used the update() and display() functions for this, which made the code more organized.



Week 3 – Creative Reading

I really liked this text because of the way Crawford approaches interactivity as a whole and gives it a more three-dimensional aspect. I especially liked how he shows that there are different levels of interactivity, from low to high rather than treating something as simply interactive or not interactive. I think this gives a clearer way of understanding interactivity. Based on Crawford’s idea of listening, thinking and speaking, I think a strongly interactive system should have all three, but I would consider thinking and speaking especially important. The more the user can think, make decisions and respond to the system through their actions, the more interactive the object becomes. At the same time the system should listen and respond to what the user is doing. I also think a strong interactive system should give the user something back, whether that is learning something new, being influenced by the system or simply having fun.

When I think about my own p5 sketches, I feel like they suffer from a lack of interactivity because they sometimes fall into the same kind of low interaction Crawford describes with his refrigerator example. Usually, the interaction is limited to following a rule, such as pressing a button to see something else or moving the cursor to see a new colour. I could improve my p5 sketches by moving away from simple mouse clicks and allowing the system to respond differently based on what the user has already done. For example, instead of choosing colours randomly from a fixed array, the sketch could remember previous interactions and use that information to create different responses. This would make the system feel more responsive rather than just random. I also want to experiment with more complicated forms of interaction such as storing information from the users previous actions. Overall, this reading made me think about interactivity as more than just making something respond to the user. It made me think about whether the system is actually listening, thinking and responding in a way that gives the user a reason to continue interacting with it.

Week 2 – Animation, Conditionals, Loops

My Concept

Computer vision showed me that you can have order and chaos at the same time using the random() function. I found this task a bit harder than the self-portrait because I had to explore a new idea with loops. I have only used loops for simple tasks in my other computer classes but I had never used them to draw or create random things. They were always very fixed. I took inspiration from the Casey Reas talk and really wanted to use lines. He showed a lot of examples of lines and how they can have the freedom to do whatever they want, so I wanted to see the intricate things these lines could create by themselves through the computer. I started with the idea that I wanted the lines to have control over where they start, where they can and cannot go their speed and their movement. For my first draft, I used a 500 x 500 canvas with a circle in the middle with a circumference of 100. Using the random() function, a line could be drawn within that space and move at a random speed. However, I also gave it boundaries so it could not go outside the circle. I then wanted to make it more personalized, so I remembered the four colors of the UAE flag. I scaled it down and made four boxes in two rows and two columns. I calculated the centre point of each box and made the lines spawn from there at their own random speeds. I really enjoyed the fact that I could have so much control while the output still looked very chaotic. I can explain how I made it, why I made it and what rules I gave it, but the computer created the final result through those rules and randomness.

Embedded Sketch

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

One part of my code that I am particularly proud of is the mouse interaction. I used dist() to calculate the distance between the mouse and each moving line. When the mouse gets within 50 pixels of a line; the line changes color depending on which box it belongs to. This makes the artwork interactive because the colors respond to where the viewer moves their mouse. I also like that I used the same code to create different reactions in all four boxes instead of having to write completely separate code for each one.

let distanceFromMouse = dist(mouseX, mouseY, x[i], y[i]);

if (distanceFromMouse < 50) {

  if (boxNumber == 0) {
    stroke(200, 50, 50);       // red
  }

  if (boxNumber == 1) {
    stroke(50, 170, 80);       // green
  }

  if (boxNumber == 2) {
    stroke(235, 235, 235);     // white
  }

  if (boxNumber == 3) {
    stroke(40, 40, 40);       // black
  }

} else {
  stroke(30, 80, 180);        // Blue when mouse is far away
}

 

How Was This Made

I got the initial idea for this project from the Casey Reas videos, as I explained in my concept paragraph. I also watched The Coding Train video on the random() function to understand how I could use randomness in my code LINK. For the other parts of the code, such as the for loops, I used the class content and notes. The only part I searched for separately was how to create the specific interaction I wanted, which led me to the p5.js dist() reference page LINK. I used this to help write the code for the lines reacting to the mouse. I also used CSS RGB to choose the colors for the project especially using the scrolling function where I could pick my own color LINK.

Reflection and ideas for future work or improvements

For this project, I learned a lot about computer vision, but I also learned about controlling something while giving it the freedom to do whatever it wants. At first this was a little off-putting because I was not fully in control of what the lines were doing. I liked how the random() function can randomize objects in ways that I would not have thought of myself. For improvements, I would want the lines to be more flowy because I felt like they were very rigid when they bounced off the walls. I wish they could curve and move more naturally but I did not fully understand how to create that effect yet. Overall, I really liked working with the topic of computer vision and would like to explore it more.

Week 2 – Reading Reflection

Casey Reas’s talk really changed the way I think about randomness in art. Before watching it I mostly thought of randomness as something that takes away the artist’s control and gives freedom to the computer  but I now see that randomness can still be intentional when the artist creates the rules and limits first. What interested me most was how Reas showed that order and chaos can exist together. The biological pieces especially stood out to me such as the representations of proteins, cancer cells and tissue. Computer vision was being used to visualize things that would normally be strange or difficult to represent visually but the results became these beautiful organic forms. I was particularly drawn to the pieces made from long lines that curve and build into cirI was also interested in how the same idea of randomness could be used in completely different fields, from biological structures to fashion, vehicles, music and movement. It made me think of how something that looks chaotic can still convey a certain feeling or idea if the artist has created an underlying structure.

The talk also made me question where I personally want the balance between randomness and control to be. I do not think that more randomness automatically makes a piece more interesting. If everything is random, I feel that the work can become visual noise and lose the artist’s intention. For me, the most interesting point is when the artist controls the concept, structure and limits, while the computer controls smaller decisions within those boundaries. I never thought such a simple coding function could create art at a technical level. I now see code more like an artistic medium similar to paints where the artist can set the rules and allow the system to produce something unexpected. Reas’ examples of random numbers and the idea of making small changes that create chaos in an ordered way also made me think about how even very small variations can completely change an outcome.

For my production project, I think I want to explore this idea through the biological-inspired visual art. The pieces with the long, flowing lines that formed these organic structures were probably what interested me the most because they reminded me of something alive and gave me this feeling of freedom and flow. I want to try creating something similar where I have control over the overall structure, but I don’t control every little detail. For example, I could use randomness to decide the direction, length, color or movement of the lines. I think that would make the process more interesting because I would still have an idea of what I want the piece to feel like but I would also be able to see what the computer comes up with on its own.

Week 1 – Self-Portrait

Concept

For this assignment I needed to use P5.JS to create a self portrait. I wanted to be very practical so I did a very basic portrait of me. All the facial features had their own functions and I tried to mimic the NYU Sexton Square palm trees and front view and also added the blistering sun of Abu Dhabi. I focused a lot on the eyes, trying out all the different shapes that we were introduced to in class and also searched for P5.js reference websites to find out the different mapping for each shape and understanding how I can apply it onto a self portrait. My self portrait represents me in my favourite place and a place that also crushes me. I love NYUAD; it always brings me so much comfort. The campus is very open and being outside and seeing all the people walking around it brings me a lot of peace and happiness and I wanted to represent that in the picture. To show a bit of my personality as well I added the colour of one of my favourite musicals Beetlejuice which is green and purple but I made it more interactive with the mouse.

Highlight of some code I am proud of:

I spent a long time trying to make the reflection in the eyes interactive with the mouse. It took a while for me to figure it out, but when I was reading the reference for P5.js that the professor showed us how to access in class, I learned about mapping. It is basically used to scale down the mouse movements, so for every 500 it will only do three increments. In this, I created a mapping so it could only move on the top left side of my eye with the movement of the mouse. This is where I found it: MAPPING.

// reflection 
  fill(255);
  
  let offsetX = map(mouseX, 0, width, -3, 3, true);
  let offsetY = map(mouseY, 0, height, -3, 3, true);

  ellipse(210 - 4 + offsetX, 215 - 4 + offsetY, 4, 4);

  ellipse(290 - 4 + offsetX, 215 - 4 + offsetY, 4, 4);

Embedded Sketch

How this was made

Immediately after class I was very interested in the interactivity and the shapes, so I created the circle in circle thing with the purple and green background at the bottom half of the background. I was experimenting with it by adding more circles, changing the strokes, making the circles thicker or thinner, and everything. So when I started doing the assignment, I decided to put this inside as well. I used the reference website for P5.js for most of the shapes and then also for the mapping. I used more of the P5.js references and I also watched a few videos from The Coding Train to understand how it works more.

Reflection and ideas for future work or improvements

I wish I spent more time on the palms and the background because I feel like I could’ve done better. I feel like it could’ve been more realistic, but I enjoyed creating the palms, I enjoyed creating the sun and I enjoyed doing all of it honestly. I wish I was more creative with it. I wish I added a few more of my interests. I wish I added a hand so I could add bracelets or maybe a different colour of hijab or abaya or something like that.