https://github.com/ITPNYU/ICM-2024-Code/wiki/Homework-Dave-02

https://editor.p5js.org/Siming2024/sketches/hd-hzFfiZ

My plan is to

  1. rewrite the folding fan and pine tree I made in the past few weeks using objects.

  2. Play with it and add a simple interaction.

Screenshot 2024-10-17 at 1.09.31 AM.png

I added loops to make the pine trees cover the background and to toggle the background color change with the fan's unfolding movement.

Screenshot 2024-10-17 at 2.25.16 AM.png

Process breakdown:

  1. Create two objects: "folding fan" and "pine tree." For the "fan leaf," I still use a self-defined function borrowed from last week's homework (this.drawFanLeaf())
  2. In the "folding fan" object, use two push()/pop() pairs and a loop to ensure the fan leaves rotate from the center (this.x, this.y) without affecting other parts of the code, such as the pine tree's position.
  3. Add a condition to position the fan in the center of the canvas.
  4. Add a loop to draw multiple pine trees to cover the canvas.
  5. Use variables for colors.
  6. Interaction 1: Map the folding fan to mouse movement.