Link to my project: https://editor.p5js.org/rl4800/sketches/KjViTWylr
This is a character based on the socket. Its hair is rotating, as I designed it to look like a plugger. Besides, to make it look like a human, I added a body and legs, a blusher, and a skirt.
I stored the different colors in the array. I used them to store different colors, so it would make my code clearer and tidier.
When I drew the lips, legs, and hair, I used the function translate, push, and pop to rotate the shape I want and not affect other shapes.
I guess the uses of User-Defined Functions are:
- It could make the code clear in what part is for what purpose, and that enables the producer to modify it easily.
- It could reduce the amount of code written by programmers because it could execute repetitive codes.
I mainly gave x,y, and s to the function as the given sample. They modify the position of shapes by coordinates, and the size of the shape by changing the scales.
I guess in my code nothing would radically change without calling a new function. So I am still confused about what would happen without it.