Lingwu Li

Creative Task:

This week’s task asked us to reorganize our sketches into functional units of labor. I revisited my Week 1 portrait and made some adjustments.

One interesting challenge I encountered was with layering. At first, I wanted to separate the hair and the face into two different functions. However, I realized that the drawing order mattered: I originally drew the base hair, then the face, and finally the bangs on top. If I split hair into its own function, I couldn’t achieve this layered effect correctly. In the end, I combined everything into a single drawHead() function so the layering would remain consistent.

image.png

For the challenge, I rewrote drawMouth() into a reusable function with parameters. Now I can call it with different values to generate different moods. When Ai is sleeping (mood=”sleeping”), her mouth is drawn closed; when she is happy (mood=”happy”), the mouth curves upward; and when she is sad (mood=”sad”), the mouth curves downward.

image.png

image.png

image.png

Worksheet question of this week:

In this week’s worksheet, I ran into a problem in the last question. My original bounce() function looked like this:

function bounce(currentValue, speed, minValue, maxValue) {

if (currentValue > maxValue || currentValue < minValue) speed *= -1;

}

I thought passing in different speeds (like xSpeed, ySpeed, or colorSpeed) would update them inside the function, but I found out this doesn’t work. I realized that the variables inside the function are local, and the values passed in are just copies, not references. So modifying them doesn’t affect the outside variables. I fixed this by adding a return value and reassigning it outside the function. I'm not sure whether this is the best approach.

Video Notes:

encapsulation 封装:data+functionality→object

specify具体说明,比如specify the data for the bubble