I revisited my previous self-portrait and now my draw() function looks much cleaner I added parameters to make these functions more flexible. For example, in drawEyes(x, y, d), I can change the position of the eyes by adjusting x and y, and control the distance between the two eyes using d. Similarly, I added parameters to control the width of the body, the height of the neck, and the speed of the moving hair. I also reorganized my background into drawGrid(r, g, b), which allows me to change the colors of the grid without modifying the function itself.

However, I realized that although my code is more organized, many of the calculations inside my functions are still very fixed. For example, in my drawEyes() function, I use expressions like x - 10, y - 50, and x + 5 to position different elements. Although these values work for my current drawing, they are based on specific measurements that I manually adjusted until everything looked right. The same problem appears in other functions. Even though I introduced parameters, some parts of the drawing still rely on hard-coded coordinates. This means that changing one parameter doesn't necessarily adjust the entire shape proportionally. Questions

  1. How can I make the math inside my functions more flexible and reusable? Right now, I use a lot of fixed offsets, such as x + 10, y - 40, or x + 50. Is there a better way to calculate these positions so that the proportions of the drawing stay consistent when I change the parameters?
  2. How can I make different parts of a drawing respond proportionally to one parameter? For example, if I change the width of the face, is there a way to automatically adjust the positions and sizes of the eyes, eyebrows, and mouth without manually changing each value?