For this assignment, since I am (very!) new to coding, I decided to take it easy and to simply explore the options available on p5 in order to create my self-portrait. I therefore opted for something rather realistic than creative so I could focus on the code itself.
However, I couldn’t help but go further and add some extra things that would make this portrait more like me. The main thing I added are the three stars in the background. My last name, “Najm”, means star in Arabic. Therefore, the star has become a very symbolic element in my life. Even as an artist, my signature is an eye with a star as a pupil. So, the star means a lot to me in my personal life, extending into my art.
// star! fill(255, 217, 102); stroke(0, 10, 134); strokeWeight(3); beginShape(); vertex(470, 430); vertex(500, 430); vertex(510, 400); vertex(520, 430); vertex(550, 430); vertex(530, 450); vertex(540, 480); vertex(510, 460); vertex(480, 480); vertex(490, 450); vertex(470, 430); endShape();
Above is my code for one of the stars. I particularly enjoyed coding this part as I had to figure out how to use the beginShape() function, and I found it fun. I then copied the code and simply changed the coordinates in order to play around with size and position. I would eventually like to learn how to animate them, although as of now I still can’t grasp the whole variable animation thing.
Here is what my self-portrait looked like in the end:
There are two things to note, which I would like to improve for next time:
- In the code itself, I repeat the fill() and stroke() functions unnecessarily. I understand that these functions will apply to the following ones until I want to create a new shape or element with different characteristics. However, I just found it easier for today to add the same color multiple times in a row. It did clutter my code a bit though.
- I really couldn’t figure out how the arguments for the curve function work. The anchor points made sense but the control points didn’t. I ended up just playing around with those (for the eyebrows, eyelashes, and necklace) until they looked satisfying; trial and error basically. I wanted to also do the front pieces of my hair with the curves but I couldn’t get it right for the life of me.