Coding Assignment – Week#1

My objective of this self-portrait assignment was to create a dynamic and animated self-portrait, drawing inspiration from the style of cartoons. The core idea was to give the portrait an animated look by discarding outlines and instead focusing on bold strokes, vibrant colors, and animated elements. I wanted to add some personal character elements as well, such as my silver earrings and short lighter hair. I believe the eyeroll-like animation also matches my look, as I sometimes receive comments that I appeared as a traditionally mean and cold Eastern European when people would first see me, and that they would be proven wrong after a while. Since the overall look of the portrait is cartoonish, the mean eye-roll appears quite cute and ironic.

Here is the sketch:


That said, I was quite proud of the eyelash animation. I used iteration from -20 to 0 to create eyelashes above the eye, and by adding the lashSpacing I was able to separate them from each other. By using the map() function, I was able to calculate the position of one of the eyelashes. I used the cos() function to create a value that swings between -1 and 1 based on the angle (angle + i). I then mapped it to a range between -10 and 10 and created a centered motion around 0, giving the eyelashes a natural appearance. I then drew each eyelash separately using the lashX coordinates for the upper vertices of the lines.

// Adding eyelashes with animation and spacing
for (let i = -20; i <= 0; i += lashSpacing) {
  // Calculate the x-coordinate for the first eyelash, centered around 0
  let lashX1 = map(cos(angle + i), -1, 1, -10, 10); 
  //Separating by 10 pixels the other 2 eyelashes
  let lashX2 = lashX1 + 10; 
  let lashX3 = lashX1 - 10; 
  stroke(0); 
  // Setting the thickness of the lines
  strokeWeight(2); 
  // drawing the eyelashes
  line(0, -16, lashX1, -25); 
  line(10, -14, lashX2, -25); 
  line(-10, -14, lashX3, -25); 
}
pop();

I was also proud of the gradient code. I used a for loop again to blend the colors by calculating a color for every line of pixels on the canvas with the help of the lerpColor().

function draw() {
  // Defining colors for the gradient
  let color1 = color(0, 0, 139);
  let color2 = color(100, 100, 255);

  // Creating a gradient background. Iterating through each vertical line of pixels
  for (let i = 0; i < height; i++) {
    // mapping the current value of i from the range 0 to height to a new range from 0 to 1
    let inter = map(i, 0, height, 0, 1);
    // calculating a color for each line of pixels using the lerpColor function
    let c = lerpColor(color1, color2, inter);
    // setting the stroke color and drawing a line through full horizontal distance of the canvas
    stroke(c);
    line(0, i, width, i);
  }

For future improvements, I would like to make the code cleaner and simpler, less repetitive. Exploring object-oriented programming techniques could be an intriguing strategy as well, which should help in making the code more organized.

 

https://editor.p5js.org/llluka/sketches/LgUxOAe6N

Week#1 – self-portrait

p5.js assignment#1 was an entirely jarring, anxiety-inducing experience. I severely struggled with understanding javascript code and hence this assignment felt like the biggest milestone. Whilst I still feel that to some extent I don’t entirely understand p5.js coding, I tried to adapt the best I could, within limited time constraints, by using a mixture of simple shapes and what I consider some high level codes to conjure a self-portrait.

I had the hardest time with determining the correct coordinates and so there were lots of trial and error in placing shapes and curves, specifically with the bezier() function. The double eyelids were the hardest to recreate and therefore took considerable time perfecting them. Once I had established a desirable curve I used the translate() function to transfer it to my right eye. Any features that required the bezier()/ beziervertex() function I was proud of:

//lips
fill(255,144,137);
beginShape();
vertex(380, 465);
bezierVertex(380, 465, 390, 450, 400, 465);
bezierVertex(400, 465, 410, 450, 420, 465);
bezierVertex(420, 465, 400, 490, 380, 465);
endShape();
//eyelids
noFill();
bezier(382, 393, 365, 375, 338, 385, 332, 393);
push();
translate(85, 0);
bezier(385, 393, 365, 375, 338, 385, 332, 393);
pop();

Through the fill()/ nostroke()/ translate() functions, I was able to discover and utilise the push() and pop() functions, which corrected many placement/ color errors that tended to occur. To compensate the lack of an interactive quality, I put substantial care into the aesthetics of the self-portrait. If I had a little more time, I would have loved to dabble in javascript coding for adding loops. Making the clouds move repeatedly would certainly make this assignment a more dynamic piece.

 

 

 

 

 

 

 

 

 

Reading Reflection – Week 2

Casey’s talk at the Eyeo Festival 2012 first introduced the usage of randomness in modern art starting from the 20th century, then showed some of his work that used the concept of chance within algorithmic rules. I find this concept very interesting because, intuitively, chaos and art don’t belong together. Just as random alphabets combined don’t convey information, random pixels featuring random colors also shouldn’t have artistic value. However, Casey and various other artists created artistic pieces by combining chaos with some constraints, which is simply amazing. Also, these artworks are closely related to algorithms and technology, which I am particularly interested in.

When I heard about combining randomness with art, I immediately thought of the infinite monkey theorem. This theorem states that, given an endless amount of time, a monkey randomly typing on a typewriter can type out anything, including Shakespeare’s “Hamlet” word for word. Changing to computed art instead of typing would mean randomly distributed pixels on a canvas can produce artworks like “Mona Lisa” to a specific resolution. Casey’s works are like using programming algorithms to give instructions to the “monkey” while maintaining its freedom to an extent so that it could produce abstract pieces of art. The algorithms also provide interactivity to artworks that are otherwise impossible in traditional art pieces. Therefore, the artist’s job is no longer creating art itself, but generating rules for the “monkey” to enter the art piece’s basic building blocks randomly. This is also very intriguing to me.

Week1: Self Portrait

The concept:
For this assignment, I tried to implement some dynamic functionality while keeping the design visually appealing. So, I implemented two backgrounds that basically reflects my two main areas of interest, coding and design. The design background is a display of randomly-oriented “Fady” texts of different colors. The other background follows the same idea but displaying binary number instead. Also, another indicator of my identity is the text written on the hoodie that also changes by switching between both roles. A viewer can switch between the two backgrounds by clicking the two buttons on both sides of my character.

A highlight I am proud of:
The most important part of my portrait is the possibility to switch between both backgrounds. So, I am proud of this part of code that where I used functions to implement my idea.

code screenshot

The Sketch:

Future improvements:
While I am proud of doing this kind of art, I find the face doesn’t look like mine. So, some future improvements or recommendations include re-creating a character that looks more like me.

 

Week 1: Self-Portrait

For the self portrait assignment I had the idea of recreating the painting “The Son of Man” by René Magritte. What I appreciate about the painting is its simplicity and the way it could be worked in the project. The general idea of the painting can be easily recreated in the library, even with simple shapes. In other words, it might not look aesthetically pleasing, but anyone that knows the painting would be able to recognize it here. Moreover, the fact that there is an apple in front of the face opens many fun possibilities that could be drawn. I wanted something silly so I just went with a stick face that appears when the screen is clicked.

In terms of code there is nothing exceptional that could be highlighted. I guess I am proud that I managed to make something that looks decent, although I know I will do way more once we progress in class. However, here is the simple onclick toggle to switch between apple and face that can also be seen in the documentation.

if (mouseIsPressed == true) {
  if (mouseButton == LEFT) {
    strokeWeight(0)
    fill(0);
    circle(-40, -20, 20) // left eye
    circle(40, -20, 20) // right eye
    rect(-30, 40, 60, 20); // mouth
  }
}
else {
  fill(140, 174, 152);  // apple
  ellipse(1, 10, 150, 140);
}

In the future I will make sure to add more interactivity and utilize vertexes for better drawings.

Assignment 1: Self Portrait

For this assignment, the task was to create a self-portrait, and I’ll admit I’m someone who can’t draw at all. So, I approached this assignment with a mixture of excitement and nervousness and I decided to keep my self-portrait simple yet cute, which I hope would come across effectively.

I began by sketching the outline for the head and hair. It started off decently, but I faced significant challenges when it came to layering various shapes to achieve the correct hair texture. After a few tries, I eventually managed to get it  right.

So initially this is how my portrait looked like

And this is what my final portrait looks like

As I mentioned before, I take pride in the part of the code that allowed me to create the hair, even though it might not be particularly intricate. The layering aspect was a challenging but rewarding aspect of this assignment.

Working on this project was a delightful experience because it made me realize that while I might struggle with drawing on paper, I can create something visually appealing using Processing. I particularly enjoyed adding interactivity to my portrait, as I believe it adds an interesting dimension to the work. While I am satisfied with my final submission, there are a few areas I would like to improve upon. One of them is creating a more detailed body for my self-portrait since I kept it relatively simple this time.

Week 1: Self-Portrait

Concept:

For this assignment, my goal was to create an abstract and visually pleasing composition by utilizing various shapes and colors. I incorporated my favorite hues, such as baby pink and blue, into the portrait. The choice of having the portrait not look directly at the viewer but rather upside down symbolizes my personality, which tends to be optimistic and focused on finding the positives in life.

Highlight of Some Code I’m Proud Of:

// Text in Rotation

 let radius = 150; // Radius at which text rotates
 let textRotate = "Buka  Buka  Buka  Buka  Buka  ";
 let textArray = textRotate.split("");

 let angleStep = (2 * PI) / textArray.length;

 for (let i = 0; i < textArray.length; i++) {
   let x = w / 2 + radius * cos(-angle3 + i * angleStep);
   let y = h / 2 + radius * sin(-angle3 + i * angleStep);

   textSize(50);
   fill(232, 112, 133);
   noStroke();
   text(textArray[i], x, y);
 }

 angle3 += radians(1);

One aspect of the code that I take pride in is the rotation of text at the bottom right of the screen. This part turned out to be more challenging than I initially anticipated. While I had already created a rotating arch in the background, arranging individual letters to rotate around a circular path was a more complex task. Although I’m not entirely satisfied with the final result, I’m proud of how I managed to implement it.

Embedded sketch: 

Reflection and Ideas for Future Work or Improvements:

Despite my overall satisfaction with the portrait, I feel that it doesn’t fully capture my essence. In future projects, I would like to explore ways to infuse more personal elements into my works, creating a stronger connection between the piece and my identity. This could involve experimenting with different styles, techniques, or thematic elements to achieve a more accurate representation of myself.

Week 1: Self-Portrait

The Concept:

For this project I wanted to try to code something that reflects in any form or sense who I am as a person. I kept racking my brain for ideas but I didn’t have any that I particularly liked so I just started drawing random things. I started with ellipses, a big one, a smaller one, an even smaller one. I created them non concentric because I don’t like everything to be perfectly aligned. Then I decided why not make it the background and just draw a simple face that resembles me on top. Then I started thinking about colors; I was too indecisive to choose one color so I settled on three!

The three colors I used for the background represent the sun, sea and grass because one thing about me is that I enjoy being by the beach and going to parks since nature has a very calming effect on me. 

By clicking the mouse, not only does the background change but also my facial expressions do too. I go from happy to surprised to pissed off. I wish I could say that the expressions relate to the background color or something cool like that, but it was really just an attempt at challenging myself to experiment further with p5.js. 

I added AirPods to the portrait because I am almost always listening to music. Music has been such a big part of my life for so long, I couldn’t draw a self-portrait without including any element of music into it. However, the AirPods are missing in the “pissed off” version of myself, because I can never get pissed off while listening to music.

As you move the mouse around the screen, the eyes follow the movement of the mouse because I wanted to add an element of interactivity in the portrait, but you could also say it reflects my curious nature.

A highlight I’m proud of:

Although it may seem very trivial, I had such a hard time getting the eyebrows to look the way I wanted them to. So I am proud of the final result I reached.

//eyebrows
fill(hair);

if(option == 1){ //straight brows
    bezier((width/2)-15, (height/2)-30, (width/2)-35, (height/2)-35, (width/2)-45, (height/2)-30, (width/2)-50, (height/2)-25);
    bezier((width/2)+15, (height/2)-30, (width/2)+35, (height/2)-35, (width/2)+45, (height/2)-30, (width/2)+50, (height/2)-25);    
}
else{if(option == 2){ //surprised brows
          bezier((width/2)-15, (height/2)-40, (width/2)-35, (height/2)-45, (width/2)-45, (height/2)-40, (width/2)-50, (height/2)-35);
          bezier((width/2)+15, (height/2)-40, (width/2)+35, (height/2)-45, (width/2)+45, (height/2)-40, (width/2)+50, (height/2)-35); 
      } 
     else{if(option == 3){ //pissed off brows
          bezier((width/2)-15, (height/2)-25, (width/2)-35, (height/2)-35, (width/2)-45, (height/2)-30, (width/2)-50, (height/2)-30);
       
          bezier((width/2)+15, (height/2)-25, (width/2)+35, (height/2)-35, (width/2)+45, (height/2)-30, (width/2)+50, (height/2)-30);
          }
     }
}

Another part I am particularly proud of is the way I had the background colors change with every mouse click.

if(option == 1){ 
    
    let blue0 = color(59, 197, 255);
    let blue1 = color(135, 219, 255);
    let blue2 = color(110, 212, 255);
    let blue3 = color(161, 227, 255);
    
    //non concentric circles in the background
    background(blue0);
    noStroke();
    fill(blue1);
    ellipse(150,150,500);
    fill(blue2);
    ellipse(200,150,350);
    fill(blue3);
    ellipse(150,150,200);
  
    // changes option to 2 so that the frame changes with next mouse click
    option = 2;
    // drawMe() function is called todraw the face over the desired background
    drawMe(); 
}

// second mouse click, changes background from blue to green (along with other changes further described in drawMe() function)
else{if(option == 2){
      
      let green0 = color(67, 166, 60);
      let green1 = color(0, 139, 0);
      let green2 = color(76, 187, 23);
      let green3 = color(97, 194, 86);

      background(green0);
      noStroke();
      fill(green1);
      ellipse(150,150,500);
      fill(green2);
      ellipse(200,150,350);
      fill(green3);
      ellipse(150,150,200);
  
      option = 3;
      drawMe();
    }
    else{if(option == 3){
      
          let yellow0 = color(255, 191, 79);
          let yellow1 = color(255, 172, 28);
          let yellow2 = color(255, 209, 130);
          let yellow3 = color(255, 228, 181);

          background(yellow0)
          fill(yellow1);
          ellipse(150,150,500);
          fill(yellow2);
          ellipse(200,150,350);
          fill(yellow3);
          ellipse(150,150,200);
      
          drawMe();
      
          //resets option to 1 so that backgrounds can loop
          option = 1;
          }  
      } 
  }

 

Reflection and ideas for future work or improvements:

Working on this assignment was very fun, I kept pushing myself to try new things and I stuck into this loop of constantly wanting to add more features without complicating it too much. It was hard for me to decide where to draw the finish line. For future work, I would like to work on having more interactivity and creativity within my code. I would also like to work on making my code more efficient by removing redundant repetition of code. 

assignment 1 – self portrait

Concept

My main focus for this assignment was the aesthetics of it. Because I wanted to focus more on making something visually pleasing, I started off ambitious – I had made a cartoonish sketch of myself and was hoping to recreate it in Processing. It seemed possible if I broke down the drawing into small curves.

While it most certainly was possible, I underestimated the difficulty of doing so. However, as we discussed in class, even the way things fail can be inspirational in itself. As I was trying (and failing) to construct the initial sketch, I noticed that what I had looked very similar to minimalist line art. I realized a line art representation of myself was not only much more feasible but also more indicative of the features I see most representative of myself, like my glasses, my mole, and my often-worn heart-shaped earrings.

I also really love pastel color palettes, so I wanted to incorporate them into my portrait. I decided to make the background(s) of the portrait some of my favorite palettes. Every time the canvas is clicked, it changes the color palette. There are five in total.

Implementation

Like I said, because I focused mostly on the aesthetics of it the technical implementation isn’t the most out-of-this-world. I, however, like the idea of having different sized blobs in the background (which I believe makes the whole portrait visually appealing). The mathematics of implementing the blob I learnt from this article, which I then modified a bit to have animated.

  for (let k = 0; k < blobs.length; k++) { 
    let blobPoints = []
    push();
    noStroke();
    fill(blobs[k].colors[currentPalette])
    beginShape();
    translate(blobs[k].x, blobs[k].y); 
    for(let i = 0; i < res; i++) {
      //make sure circle isn'getting too big or too small
      rad += random(-20,20);
      rad = constrain(rad, blobs[k].minRad, blobs[k].maxRad); 
      let x = rad * cos(angle * i);
      let y = rad * sin(angle * i);
      blobPoints.push([x, y])
      curveVertex(x,y);
   }
    for (let j = 0; j < 3; j++) {
      curveVertex(blobPoints[j][0], blobPoints[j][1])
    }
    endShape();
    pop();
}

Reflections and Improvements

While I’m happy with the way my self-portrait turned out, I don’t like the way the curves were made. It was a lot drawing of lines with hard-coded coordinates, so it is not adjustable in anyway, so making the line art itself interactive in any capacity feels very difficult. For my next project, I want to focus more on using symmetry and geometry in the location of elements.

 

Week 1- Self-portrait

My concept: The movie “Barbie” was one of the most discussed films this summer, which raised many issues in society such as discrimination, existential crisis, the negative effect of patriarchy for all etc. I wanted to create my self-portrait in the Barbie style, keeping the pink vibe of the childhood Barbie cartoons and dolls in addition to the main message of girlhood. Girlhood is all about growing, finding yourself and the concept of ‘girl supporting girls’, giving a raise to feminism. Because of this, my self-portrait uses pastel colours with a focus on pink specifically and contains the popular phrase “GRL PWR” on the eyeglasses which is essentially a “Girl Power” and the phrase from “Barbie” movie as “kENOUGH”. Overall, my self-portrait was inspired by the childhood cartoon and the recent movie “Barbie”, promoting the idea of girlhood and feminism. 

From the technical aspect, the portrait has dynamic things such as bouncing hearts up and down, an increasing blue circle with the movement of the mouse and moving the word ‘kENOUGH’ from left to right. Moreover the word ‘click’ is moved with the mouse to show that the user has to click on the screen to see the change of the colour of eyeglasses and the phrase “GRL PWR” appears.  

A highlight of the code I am proud of is the code of the moving hearts because each heart was created with simple shapes such as circles and triangles. Secondly, each of these shapes was made to move up and down by bouncing. Initially, the bouncing part was hard for me because the hearts were moving indefinitely downwards and then I recalled the class about the importance of giving the limits to the movements of objects to make them bounce back from that limit. 

let y = 40;
let goDown = false;
function setup() {
  createCanvas(320, 400);
}

function draw() {
  background(226,201,221);

//moving hearts
  fill(227, 102, 152);
  circle(40, y, 10);
  circle(50, y, 10);
  triangle(35, y+1, 55, y+1, 45, y+15);
  
  if(goDown == false) {
  y=y+2
  }
  if(y<0) {
    goDown=false;
  }
  if(goDown == true) {
  y=y-2
  }
  if(y>400) {
    goDown = true;
  }

Moreover, I am proud of the overall process from the initial sketch on the iPad to the final project. As this was my very first coding experience, I had fun. To realize my idea, I drew the project’s coordinate system and raw sketch. Because of this, it was easier for me to find the coordinate points and draw the shapes. 

Pic 1. Initial Sketch on the coordinate system

Embedded sketch: CLICK on the screen; MOVE the mouse right and left.

Reflection and ideas for future work or improvements: I would make the movement of ‘kENOUGH’ continuously, not just going back and forth because I think that the space left at the beginning of the word train is not aesthetically pleasing. Additionally, I would try to make the castle more realistic and add some interactivity to it, such as making it flush, changing the color, etc.