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.