Concept
In this assignment, I created a cartoon style portrait of myself. I practiced how to create basic shapes such as ellipses and circles, points, curves and lines. I also practiced using colors and changing the thickness of lines and shapes.
I made the portrait interactive by changing the portrait into night mode when the mouse is clicked, changing the background colors into darker colors and adding stars to represent night time.
Code I’m proud of
The part of the code I am most proud is how I change settings from day time to night time by using if condition. When the mouse is pressed, the background colors of the portrait is changed and stars are added to create the effect of change of time
// Declaration of colors
let a, b, c;
// Change colors when mouse is pressed
if (mouseIsPressed) {
a = color(200, 200, 200);
b = color(0, 100, 0);
c = color(0, 0, 139);
} else {
a = color(243, 243, 25);
b = color(0, 128, 0);
c = color(173, 216, 230);
}
// Use background color
background(c);
// Stars
if (mouseIsPressed) {
textSize(90);
text("✨", 200, 90)
}
Here is my portrait
Reflection
This was a very fun exercise where I got to explore using p5 to create images. While this is my first time doing something like this, I really enjoyed and opened to exploring it more. I can improve this project by making it more interactive, making the more shapes and customizations and adding more elements to the portraits