Lingwu:
This week’s creative task is to generate a new pattern by looping a small operation multiple times. I use my previous portrait for this. I put it into a function and make some adjustments so that I can draw the portrait anywhere on the canvas and at any size. At first, I try placing the portraits at each point of a grid. However, the result looks like separate, disconnected portraits with no real pattern or visual interest. So I change my approach and arrange the portraits along a spiral instead (:з*」*∠)

function owl(x, y) { push(); // 1️⃣ 保存当前的绘图状态 translate(x, y); // 2️⃣ 平移坐标系到 (x, y) // …这里画猫头鹰… pop(); // 3️⃣ 恢复到进入 push() 时的状态 }
modularity模块化
函数的四个重点特征:reusable、portable、modularity、organization。
reusable 是针对同一个文件的
portable 是针对不同文件的
模块化就是,每个小模块负责一个小操作
organization 让代码结构更清晰