Assignment 1: Self-portrait

Self-Portrait

The aim was to draw a simple 2D portrait using basic shapes and solid colours. Since it was my first time experimenting with p5, I kept my design fairly simple and mainly worked on familiarising myself with the basic concepts. I would love to continue improvising my self-portrait as I learn new skills.

For the portrait, I used simple geometric shapes for the head, hair, eyes, nose and mouth. I used pre-defined constants like PI and QUARTER_PI to draw arcs and ellipses. I used the p5js reference library to learn how to rotate a shape.

In reflecting on this project, I realised there are many possibilities to make the portrait more creative and personalised. For example, I could add interactivity to have different facial expressions. I could also add more detail like ears, eyebrows, and hair texture. The background could be customisable with different colours or shapes.

I look forward to learning more complex p5js functionality. In my next projects, I plan to incorporate animation to bring more life into my artwork. I now feel more comfortable with the basic syntax of p5js. With more practice, I hope to make projects that are visually engaging and fun to interact with. I’m excited to continue growing my coding and creative skills.

arc(200, 300, 50, 20, 0, PI); 
// hair
strokeWeight(1);
stroke('rgb(53,30,30)');
fill('rgb(53,30,30)'); 
angleMode(RADIANS);
rotate(0.72);
ellipse(240, 35, 50, 130);
rotate(1.5);
ellipse(10, -300, 50, 130);

 

self portrait: Afra Binjerais

In my first coding project, I decided to represent myself through a unique concept, creating a digital persona that reflects my identity.

I used a triangular shape body to symbolize my abaya and incorporated a head turban, adding personal elements to the visual representation. Choosing lilac as the background, my favorite color, not only adds aesthetic appeal but also creates a connection to my preferences. I took pride in successfully integrating my name into the background and even discovered the possibility of including an emoji through my research, which was a pleasant surprise. Looking ahead, I aspire to advance my coding skills by incorporating more details like hands and feet, aiming for a more realistic depiction of a human figure.

Taking small steps and exploring the possibilities at my own pace is part of my learning journey, and I’m excited about the potential for future improvements in my coding projects.

Yaakulya’s Assignment 1: Portrait using 2D Primitive Shapes

Concept: Since my childhood, I’ve been a big fan of Batman. Therefore, I decided that my concept for this assignment would be to create a stylized portrait of Batman using basic 2D shapes in P5.js. I aimed to capture the iconic features of Batman, such as his mask, ears, and expression, while keeping the overall design simple yet recognizable.

Highlight Code: One part of the code that I’m particularly proud of is the mouth drawing section where I depicted Batman’s calm neutral expression by simple Trapezoid shape instead of just putting some simple rectangle. This was achieved by using the beginShape() and endShape() functions to create a custom shape representing the mouth, emphasizing Batman’s facial expression. Moreover I’m also proud of the iconic text “I am BATMAN !” on the body, I achieved this by using textStyle()and textAlign() functions.

Here’s my Portrait:

Here’s my Code:

function setup() {
  createCanvas(800, 600);
  background('#81838C');
}

function draw() {
  // Mask
  fill('#262626');

  
  beginShape();
  vertex(220, 110);
  vertex(160, 320);
  vertex(210, 470);
  vertex(410, 508);
  vertex(390, 485);
  vertex(410, 508);
  vertex(610, 470);
  vertex(660, 320);
  vertex(600, 110);
  endShape(CLOSE);

  // Ears
  // Left
  beginShape();
  vertex(170, 235);
  vertex(220, 10);
  vertex(280, 100);
  endShape(CLOSE);

  // Right
  beginShape();
  vertex(650, 235);
  vertex(600, 10);
  vertex(540, 100);
  endShape(CLOSE);

  // Skin
  fill('#D3B296');
  beginShape();
  vertex(200, 380);
  vertex(230, 480);
  vertex(410, 508);
  vertex(590, 480);
  vertex(620, 380);
  endShape(CLOSE);

  // Mask
  fill('#262626');
  triangle(200, 380, 410, 400, 620, 380);

  // Eyes
  fill('#EFEFEF');
  ellipse(260, 320, 100);
  ellipse(560, 320, 100);

  // Nose
  fill('#333333');
  triangle(409, 340, 385, 392, 408, 395);
  triangle(411, 340, 435, 392, 413, 395);

  // Mouth (showing neutral expression)
  fill('#A85555');
  beginShape();
  vertex(300, 440);
  vertex(340, 470);
  vertex(480, 470);
  vertex(520, 440);
  endShape();

  // Shoulders
  fill('#262626');
  rect(200, 530, 400, 80);
  fill('#FFFF00'); // Yellow color
  textSize(18);
  textStyle(BOLD);
  textAlign(CENTER, CENTER);
  text("I AM BATMAN!", 400, 570);
}

Reflection and Ideas for Future Work or Improvements: Reflecting on this assignment, I’m proud of how I utilized basic shapes to create a recognizable portrait of Batman. However, there are areas for improvement and future exploration:

1. While the overall design captures the essence of Batman, refining the details such as adding more intricate features (Curves) to the mask and ears could enhance the likeness.

2. Exploring different color palettes and textures (batman logos and yellow emblem) could add depth and dimension to the portrait, making it more visually appealing.

3. Incorporating dynamic elements such as animations or interactive features (like cape flying behind) could bring the portrait to life and engage the viewer in a more immersive experience.

Overall, this assignment was a great opportunity to experiment with primitive 2D shapes and express creativity within the constraints of P5.js. Moving forward, I look forward to further refining my skills and exploring new techniques to create even more compelling artworks.

Assignment 1 – Self Portrait – Bubbling Portrait

I just tried to paly around with p5.js after the class. My first lesson about this was “Auto-refresh” does not mean “Auto-save”. I learnt this the hard way. After turning the Auto-refresh on, I proceed to finish my code without the thought the save it. However, after an incident with losing the internet connections, my work was lost after the page was refreshed and I had to rewrite the code from scratch. Learning from mistakes, I saved my code after every changes and turned of “Auto-refresh”.

I sketch the portrait mostly by ellipse and arc. I started from the head which then includes eyes, nose, mouth, and hair. The eyes include a few different ellipses for the eyeballs. Nose and mouth are much simpler, just a single arc for each is sufficient.

However, the most difficult part for me was the hair. To make the front part, I used the arc to produce a half circle. Furthermore, I want to have highlights on the hair. I used the arc function with changes in stroke colors to mimic the hair strands. The most difficult thing in this step is to know the exact starting point and ending point of the arc. Below is the codes for it:

noFill();
stroke("white");
arc(width / 2 + 20, height / 2 - 15, 150, 120, PI, PI + HALF_PI - QUARTER_PI);
arc(width / 2 + 20, height / 2 - 15, 100, 120, PI, PI + HALF_PI - QUARTER_PI);
arc(
  width / 2 - 10,
  height / 2 - 15,
  150,
  120,
  PI + HALF_PI + QUARTER_PI,
  TWO_PI
);
arc(
  width / 2 - 20,
  height / 2 - 15,
  100,
  120,
  PI + HALF_PI + QUARTER_PI,
  TWO_PI
);

I then added a pony tail using the Bezier curve. The final steps were adding ears and body using simple ellipse codes.

Finally, I attempt to do animation in p5.js. Using circles, I assign random position for each circle after every reloading. Each circle will start with a random size. They will increase and decrease in size as time pass. This was done using the sin() function:

circle(10, 10, sin(x)*100);
x = x + 0.01;

for (let i = 0; i < 15; i++){
  circle(posLst[i][0], posLst[i][1], sin(sizeLst[i])*100);
  sizeLst[i] = sizeLst[i] + 0.01;
}

My sketch:

Reflection:

After trying this assignment, I realize that a lot of things can be replaced with variables. Then, the positions of the eyes, nose, etc. will be relative from that variable positioning. This would make any fix much easier in terms of position. I realized this halfway of my code when I want to move things a bit downwards. The more I have on the sketch, the long it takes for me to fix all of the position coordinates.

What I want to do next is to add interactivity into the sketch. My sketch currently only has some simple animation on the background. I also want to have animation on the portrait character as well as some interaction with the portrait.

(not) a Self-Portrait

So basically, I was using Duolingo and I noticed the new characters they added a while ago. I always liked the design of these characters and how they are just a bunch of smooth shapes together with nothing complicated. So I thought I would create a character that uses only circular edges shapes.

I also tried to add some interactivity to it. So, I made the eyes move with the mouse but only if the mouse is inside the eyes; other than that the eyes would be stuck to the side where the mouse is.

if (mouseX > 145 && mouseX < 175) {
  fill(00000);
  if (mouseY < 185 && mouseY > 150) {
    fill(00000);
    ellipse(mouseX, mouseY, 20, 35);
    ellipse(mouseX + 57, mouseY, 20, 35);
  } else if (mouseY >= 185) {
    fill(00000);
    ellipse(mouseX, 185, 20, 35);
    ellipse(mouseX + 57, 185, 20, 35);
  } else if (mouseY <= 150) {
    fill(00000);
    ellipse(mouseX, 150, 20, 35);
    ellipse(mouseX + 57, 150, 20, 35);
  } else {
    ellipse(mouseX, 170, 20, 35);
    ellipse(mouseX + 57, 170, 20, 35);
  }
}

The character is basically just a face with eyes, eyelids, “hair”, a fragment of the body of it, a mouth, and a tongue.

Honestly, I also was thinking of adding the functionality of clicking on the tongue of the character pulling it, and moving it forward. I tried it but it kept generating weird fragments of visuals where stuff started collapsing and not making sense visually.

Self-Portrait: Bird by Bytes

Concept

My aim was to create any drawings using geometric shapes. I had previous experience drawing illustrations but had never coded them to visualize them. That’s why I decided to go through bunch of geometric pictures on the internet and came up with the idea of making a ‘toucan’. I chose to go with a ‘funky colours’ concept, so I separated the background into two triangles and painted them different colors. Then I decided to sketch  on paper to see how many shapes I needed.

I went through everything and chose to use two triangles, four semi-circles, two rectangles, two ellipses, one line, and one circle to represent the toucan’s body. The body is formed of ellipses, the head is made of two semi-circles, the beak is made of a rectangle and a semi-circle, and the feet are made of another semi-circle.
Here is the Sketch that I made

Image

Code

Being able to rotate the ellipse diagonally, because when I was dealing with other coordinates, it was difficult for me to get the shapes to form something that resembled what I was attempting to create. And after quite a bit of effort, I was able to arrange all of the shapes in their proper arrangement. My first plan was to have transparency in the colour of some shapes, but each time I changed the transparency, the colour changed, so I used this plugin  in Chrome to retrieve the colour codes, which was quite useful. Here are some code snippets that demonstrate how I created a diagonal oval shape and animated the eye movement.

function setup() {
  createCanvas(500, 600);
  background(225);
   }

function draw() {
  // for the left triangle of the background
  c = color('hsl(65,16%,54%)');
  fill(c);
  triangle(0, 0, 500, 0, 500, 600); 

  // for the right triangle of the background
  b = color('hsl(179,43%,22%)');
  fill(b);
  triangle(0, 0, 0, 600, 500, 600); 
  

  // beak semi-circle right side
  arc(355, 135, 175, 175, radians(270), 0);
  
  // beak rect
  b = color('hsl(37,75%,52%)');
  fill(b);
  rect(270, 48, 86, 87); 
  
  //feet
  fill('#212c3f')
  arc(340, 560, 240, 240, radians(180), 0);

  //below body
  noStroke();
  fill('hsl(30,81%,59%)');
  ellipse(150, 390, 245, 190) 
  
  // rect for feet
  fill('#c2bd48');
  rect(220, 440, 115, 170);

 

  // Draw a diagonal oval
  push(); // Start a new drawing state
  translate(250, 300); // Move to the desired position
  rotate(PI / 5); // Rotate by 45 degrees (PI/4 radians)
  fill('#060d30'); // White color for the oval
  ellipse(20, 15, 380, 250); // Draw the oval at the new origin
  pop(); // Restore original state

  //bigger one - head
  fill('#212c3f')
  arc(255, 180, 300, 270, radians(90), radians(270)); 
  
  //head smaller semi-circle
  fill('#e9e4b9')
  arc(255, 120, 180, 150, radians(90), radians(270)); 
  
  // Static line above the eye
  stroke(0); // Set line color
  line(240, 95, 180, 95); // Line for the eye
  
  // Dynamic eye that follows the mouse cursor horizontally
  let eyeX = constrain(mouseX, 190, 230); // Constrain the eye's horizontal movement
  let eyeY = 107; // Keep the eye's vertical position constant
  
  fill(0); // Set fill color for the eye
  noStroke(); // No border for the eye circle
  circle(eyeX, eyeY, 20); // Draw the eye circle
}

 

Embedded sketch

Reflection

I think having a dynamic image would be a great idea. And using other forms of shapes, such as curves and beziers, would help me create a better graphic. Because it is difficult to play with shapes in such a way that the coordinates coincide without leaving unnecessary gaps. Another thing I want to improve is my understanding of color theory, because even though I was able to obtain the color codes I desired, I know I fell short of obtaining the various transperacy levels of colors required for particular shapes.

Assignment 1: Self-portrait

I embarked on a fascinating journey to bring a digital character to life using p5.js, a powerful JavaScript library. The challenge was not just to create a drawing, but to infuse it with personality and style, all through the lens of code.

Concept: A Quirky Digital Companion

My concept revolved around creating a digital character that exuded both whimsy and sophistication. Picture a figure with a charming hat, expressive eyes, and a friendly smile – a character that could be a companion on the screen, blending simplicity with a touch of elegance.

🗒️ Starting with a Blank Canvas
I began with the basics – createCanvas(600, 600) – giving myself a broad canvas for my imagination. Centering my character was crucial, so I smartly positioned it using x = width/2; y = height/2;. It felt like setting the stage for a one-of-a-kind show.

🎩 Crafting the Face and a Dapper Hat
The face had to be inviting, so I opted for a friendly, round shape using an ellipse. Then came the hat – a symbol of sophistication. Crafting it with an arc and a rect felt like adding a crown to my character.

👀 Eyes That Speak Volumes
Ah, the eyes! They were my favorite part. Getting them right was like threading a needle – a delicate balance of size and expression. With careful placement of ellipses for the whites and irises, I managed to give them a sparkle of life.

👃 A Nose with Character and a Smile to Match
The nose, created with subtle arc functions, had its own story. Not too big, not too small – just right. The mouth was a simple arc, but it carried a gentle, inviting smile, as if ready to greet the world.

👂 Ears and Neck – Bringing It All Together
The ears, though a small detail, gave the face a sense of completeness. And the neck, a sturdy rectangular foundation, made everything look harmonious.

👔 Stylish Touches with a Tie and Shoulders
Adding the tie was like putting the final piece of a puzzle. It wasn’t just about color – it was about adding character. The broad shoulders, a simple rectangle, gave the figure a sense of strength and presence.

🎨 Coloring My Creation
Choosing the colors and stroke weights was like dressing up my character for a grand ball. Every shade added a new layer of personality, turning lines and shapes into a friend I’d just made.

Proud Coding Achievement: The Eyes

The part of the code I’m particularly proud of is how I brought the eyes to life. Using the ellipse function for the whites and irises, I managed to create a gaze that was both lively and expressive. It’s these eyes that give the character its soul, making it more than just a collection of shapes.

//eyes
strokeWeight(4);
fill(255);
ellipse(3*x/4, 4*y/5, x/3.5, y/8);
ellipse(5*x/4, 4*y/5, x/3.5, y/8);

//iris
strokeWeight(3);
fill(255);
ellipse(3*x/4, 4*y/5, x/7, y/9);
ellipse(5*x/4, 4*y/5, x/7, y/9);

//pupil
fill(0);
ellipse(3*x/4, 4*y/5, x/13, y/15);
ellipse(5*x/4, 4*y/5, x/13, y/15);

Embedded Sketch: A Digital Portrait

This code, when run in a p5.js environment, brings forth a character that stands out with its unique hat and tie, set against a simple background. The colors, strokes, and shapes work in harmony to present a figure that’s both inviting and intriguing.

The code:

let x;
let y;

function setup()
{
  createCanvas(600, 600);
  x = width/2;
  y = height/2;
}
function draw() {
background(200)

//neck
fill(241, 194, 125);
stroke(205, 133, 63);
rect(x - 43, y+173, 90, 70);
  
//Face
strokeWeight(3);
fill(241, 194, 125);
ellipse(x, y, 6.5*x/5, 7*y/6);

//Hat 
fill(0); 
stroke(0);
arc(x, y - (5 * y / 12), 5 * x / 5, 200, PI, TWO_PI);
rect(x - (6.5 * x / 10), y - (5 * y / 12) - 10, 6.5 * x / 5, 20);

//eyes
strokeWeight(4);
fill(255);
ellipse(3*x/4, 4*y/5, x/3.5, y/8);
ellipse(5*x/4, 4*y/5, x/3.5, y/8);

//iris
strokeWeight(3);
fill(255);
ellipse(3*x/4, 4*y/5, x/7, y/9);
ellipse(5*x/4, 4*y/5, x/7, y/9);

//pupil
fill(0);
ellipse(3*x/4, 4*y/5, x/13, y/15);
ellipse(5*x/4, 4*y/5, x/13, y/15);


//eyebrows
strokeWeight(6);
line(3*x/4-20,4*y/5-y/10,3*x/4+20,4*y/5-y/10);
line(5*x/4-20,4*y/5-y/10,5*x/4+20,4*y/5-y/10);


//nose
noFill();
stroke(205, 133, 63);
strokeWeight(4);
arc(x+12, 5*y/6 + 10, 7, y/2.5, 0, HALF_PI);
arc(x - 23, y+30, 21, 21, HALF_PI-QUARTER_PI/3, PI+2*QUARTER_PI);
arc(x+16, y+30, 21, 21,  -HALF_PI, HALF_PI+QUARTER_PI/2);
arc(x-3, y+40, 30, 21,  0, PI);

//mouth
noFill();
stroke(0);
arc(x, y+95, 95, 21,  0, PI);
strokeWeight(7);


//ears 
strokeWeight(3);
fill(241, 194, 125);
stroke(205, 133, 63);
arc(x/3.6 + 26, y - 10, x/4, y/3.5, HALF_PI, PI+HALF_PI );
arc(x/3.6 + 26, y - 10, x/8, y/7, HALF_PI, PI+HALF_PI );
arc(x+2.9*x/4 - 26, y - 10, x/4, y/3.5, -HALF_PI, PI-HALF_PI);
arc(x+2.9*x/4 - 26, y - 10, x/8, y/7, -HALF_PI, PI-HALF_PI);

// shoulders
fill(255);
stroke(0);
rect(100, 540, 400, 80);

//tie
fill(255, 0, 0); 
triangle(x - 10, y + 240, x + 5, y + 240, x, y + 270); 
triangle(x - 15, y + 270, x + 15, y + 270, x, y + 310);

  
fill(0);
rect(x - 125, y + 240, 25, 60); 
rect(x + 100, y + 240, 25, 60);
  
}

 

Reflection and Future Directions

Reflecting on this project, I realize that while I’ve created something delightful, there’s always room for growth and innovation.

  • Animation: Bringing motion to the character, like a nodding head or blinking eyes, could add a new layer of interaction.
  • Interactivity: Allowing users to change aspects like the hat’s color or the tie’s pattern could make the character more engaging.

This project was not just about coding a character; it was about weaving a narrative through digital art. It’s a reminder that code is not just functional; it’s a canvas for creativity. As I look forward to future projects, I’m excited to explore new ways to blend storytelling with technology, creating digital experiences that resonate and delight.

Raya Tabassum: Self-Portrait Assignment

This is my first attempt at p5.js. I’ve tried to reflect my personal preferences and appearances in this “self-portrait”. My idea is to portray a Bangladeshi girl with big eyes, dark lipstick, and blush wearing a dress and a necklace. I matched the skin color with my own complexion, and the hair color with my hair highlight’s color. Concept wise I think the intention was to personalize the drawing as much as I can using only the simple shapes like ellipse, circle, arc, rectangles and straight lines. I tried to make the colors pop and to make it very detailed for example the necklace is similar to an actual one that I have with an Emerald stone, then the parting between the hair which is something very prominent in my appearance. Placing the lips and the eyelashes were the most difficult part for me I think.
I added interactivity with a smile formed on the mouth upon mouse-click with the if-else statement and mouseIsPressed function. So if you click on the image the lips change to a smile.
For improvements I think adding interactivity with the eyes opening and closing periodically and having some texts would have been nice. Also maybe making it a full-body self-portrait would be a very detailed development I believe which I intend to work on later. Overall, I loved playing with the numbers and parameters and colors and shapes to make it more and more perfect to the reality.

function setup() {
  createCanvas(500, 500);
  background(255, 182, 193); //Pink background
}

function draw() {
  //Hair
  noStroke();
  fill(90, 56, 37); // Hair color
  arc(250, 140, 200, 180, PI, 0); // Top hair
  rect(150, 140, 200, 300); // Side hair
  
  //Neck
  fill(230, 180, 145);
  rect(200, 260, 100, 70);
  
  //Dress
  fill(220, 0, 100);
  arc(250, 445, 250, 300, PI, 0, OPEN);
  
  //Necklace Design
  noFill();
  strokeWeight(2);
  stroke(255);
  arc(250, 320, 137, 200, 0, PI);
  arc(250, 317, 127, 190, 0, PI);
  stroke(0);
  fill(31.4, 78.4, 49);
  ellipse(250, 416, 9, 12);

  //Face
  stroke(0);
  strokeWeight(1);
  fill(230, 180, 145); //Skin color
  ellipse(250, 200, 170, 195); //Face shape
 
  //Eyes
  fill(255); //White of the eyes
  ellipse(215, 180, 40, 20); //Left eye
  ellipse(285, 180, 40, 20); //Right eye
  fill(0); //Pupil color
  ellipse(215, 180, 10, 20); //Left pupil
  ellipse(285, 180, 10, 20); //Right pupil

  // Eyelashes
  stroke(0);
  strokeWeight(0.5);
  // Left eye eyelashes
  for (let i = 0; i < 5; i++) {
    line(190 + i * 6, 162, 200 + i * 6, 172);
  }
  // Right eye eyelashes
  for (let i = 0; i < 5; i++) {
    line(278 + i * 6, 172,  288 + i * 6, 162);
  }

  // Eyebrows
  strokeWeight(2);
  noFill();
  arc(215, 167, 40, 20, PI, TWO_PI); //Left eyebrow
  arc(285, 167, 40, 20, PI, TWO_PI); //Right eyebrow
  
  //Middle parting of Hair
  strokeWeight(1);
  line(250, 52, 250, 103);
  
  //Nose
  noFill();
  strokeWeight(1);
  arc(250, 210, 10, 15, 180, 90, OPEN); 
  
  //Blush
  noStroke();
  fill(255, 192, 203);
  ellipse(195, 210, 20, 10);
  ellipse(305, 210, 20, 10);

  //Forming a smiley face when mouse is pressed
  if(mouseIsPressed){
    noFill();
    stroke(0);
    arc(250, 225, 80, 45, 120, 103);
    fill(255);
    arc(250, 225, 58, 70, 120, 103, OPEN);
    
  }
  else{
    //Lips
    fill(128, 0, 0); //Lip color
    noStroke();
    arc(260, 250, 28, 12, PI, 0);
    arc(240, 250, 28, 12, PI, 0);
    arc(250, 250, 50, 20, 0, PI);
  }
}

 

Assignment 1- Aysha’s Self Portrait

For this assignment, I tried to utilize the programming concepts and primitive shapes to create a self-portrait. This involved the use of rectangles, ellipses and circles. I used this assignment to showcase what we have learned thus far, while simultaneously ensuring that it reflected my personal style.

Concept:

The main concept of the self-portrait is to capture, express, and translate basic P5 programming concepts into a visual representation of my main facial features within a sketch. In this sketch, my aim was to emphasize simplicity and minimalism, which can be seen through my focus on the basic features of the face like my skin, eyes, mouth, etc. The concept of simplicity and minimalism can be further seen in the color choice of the sketch. The muted pink, white, and browns create  ‘visual harmony’ that captures the essence of my features and the sketch as a whole. 

The process of creating this sketch involved a lot of rereading lecture notes and practicing outside of class, specifically with shapes. I initially struggled a lot with understanding how to position shapes and manipulate them to achieve my desired visual outcome, specifically the different parameters for each shape. I managed to overcome the initial struggle by playing around with the shapes and parameters. With that being said, the code I was most proud of was definitely the code that created the main facial features in my sketch due to the fact that it showcases my developed understanding of the shapes’ spatial relationships. 

Here is the code that demonstrates my understanding of the shapes’ spatial relationships: 

//Base of Eye
  fill('white')
  stroke(0);
  strokeWeight(1);
  ellipse(175, 175, 50, 25);
  ellipse (276, 176, 50, 25);
  
//Pupils
  fill ('rgb(83,29,29)')
  strokeWeight(1);
  ellipse(175, 175, 25, 25);
  ellipse (276, 176, 25, 25);
  
//Pupil Detail
  fill('white')
  ellipse(170, 170, 10, 10);
  ellipse (272, 170, 10, 10);
  
//EyeBrows
  noFill()
  strokeWeight(1.5)
  arc(175,150,40,10,PI,0); //left
  arc(275,150,40,10,PI,0); //right

//Nose
  fill('rgb(255,227,193)')
  strokeWeight(1);
  ellipse(228, 200, 20, 30);
  
//Smile
  fill('#D96771')
  arc(228, 240, 60, 50,0, PI, PIE);

 

In my code, I played around a lot with different widths, heights, x-axes, and y-axes to create a cohesive sketch. The time it took me to actually understand the different shapes’ spatial relationships allowed me to effectively understand not only P5 as a language but also how different shapes can be related to one another. In a sense, this time allowed for me to explore the intricate relationship that these different shapes have with each other, fostering a more holistic understanding of both the visual image the shapes created and programming principles. 

Despite the initial struggle, I felt really comfortable with functions such as “fill”, “stroke”, and “strokeWeight.” These functions allowed me to manage the color fillings, outline, and line thickness, helping me confidently add depth to my sketch. This helped me a lot when I was initially struggling with the shapes and their parameters as they provided me with a framework that enabled me to enhance the overall visual impact of my sketch. 

My Final Sketch: 

Reflection:

In terms of improvements, I think I can work on playing around with styles more. I feel like if I was given longer to work on this, I would most definitely would have added special styles and effects to the different shapes in my sketch. I would potentially add more complex shapes such as a shape for eyelashes or potentially control statements to create a User Interface design that would allow for the shirt to change color, adding more complexity to my sketch. Even with my ups and downs, this assignment most definitely made me more excited to learn more about how I am able to use P5 to generate effects and animations, particularly with shapes.  I enjoyed this process and cannot wait to learn more about creating ‘non-stationary’ sketches, where movement is the central theme of the sketch, allowing me to create complex designs and user interactions. 

Assignment 1- (Self-Portrait) Hamdah AlSuwaidi

Description:
For this assignment, I opted for a straightforward approach to create a self-portrait. The portrait includes various facial features, notably the eyes move horizontally due to the animation, and the eyebrows respond to the eye movement.

Sketch:

Code Implementation:

let eye1X = 170;
let eye2X = 230;
let direction1 = 1;
let direction2 = 1;
let lipYOffset = 0;

function setup() {
  angleMode(DEGREES);
  rectMode(CENTER);
  createCanvas(400, 400);
  background(240);
}

function draw() {
  background(240);

  // Draw the existing elements

  // hair
  fill(41, 38, 31);
  rect(200, 220, 205, 330, 90);

  // shirt
  fill(167, 181, 169);
  rect(200, 380, 190, 270, 40);

  // neck
  fill(245, 227, 176);
  rect(200, 239, 100, 100, 30);

  // face
  fill(245, 227, 176);
  ellipse(200, 150, 150, 175);

  // left eye
  fill(255);
  ellipse(eye1X, 143, 40, 40);

  // right eye
  ellipse(eye2X, 143, 40, 40);

  // left pupil
  fill(0);
  ellipse(eye1X, 143, 15, 20);

  // right pupil
  ellipse(eye2X, 143, 15, 20);

  // mouth
  arc(200, 192, 50, 50, 0, 180);

  // nose
  noFill();
  arc(198, 175, 20, 15, 270, 90);

  // bangs
  noStroke();
  fill(41, 38, 31);
  rect(200, 81, 90, 43, 58);
  strokeWeight(5);
  stroke(41, 38, 31);
  line(150, 115, 175, 115); // left eyebrow
  line(225, 115, 250, 115); // right eyebrow
  strokeWeight(1);
  stroke(0);



  // eye positions 
  eye1X += direction1 * 2;
  eye2X += direction2 * 2;

  // Check if eyes reach the edge and change direction
  if (eye1X <= 160 || eye1X >= 180) {
    direction1 *= -1;
  }

  if (eye2X <= 220 || eye2X >= 240) {
    direction2 *= -1;
  }

  
}