You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/tutorials/en/variables-and-change.mdx
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -747,13 +747,13 @@ In this step, you:
747
747
- added a tree made of a rectangle (tree trunk) and a triangle (leaves);
748
748
- modified the value for the y-coordinate of the top corner of the triangle (`y2`) by subtracting it by `frameCount % 290` (see [triangle()](/reference/p5/triangle) Diagram for a reminder of `y2`):
749
749
- Since you want the tree leaves to grow, the top corner of the triangle needs to move up on the canvas each time [`draw()`](/reference/p5/draw) runs. As seen in [this example](https://editor.p5js.org/p5Master718/sketches/605MEWNxh), the y-coordinate (`y2`) of the point that moves up on the canvas decreases.
750
-
- To achieve this motion, you modified the value for `y2` by subtracting `240 - frameCount % 290`. This decreases `y2` by the remainder when [`frameCount`](/reference/p5/framecount) is divided by 290.
750
+
- To achieve this motion, you modified the value for `y2` by subtracting `240 - frameCount % 290`. This decreases `y2` by the remainder when [`frameCount`](/reference/p5/frameCount) is divided by 290.
751
751
- As you saw in [Step 5](#step-5), each time the [`draw()`](/reference/p5/draw) function runs, the value returned by `frameCount % 290` increases by `1` so that `y2` also changes.
752
752
- Before [`draw()`](/reference/p5/draw) runs, `y2` is `240`.
753
753
- The first time [`draw()`](/reference/p5/draw) runs, the value from `frameCount % 290` is `1`, and `y2` becomes `239`.
754
754
- The second time [`draw()`](/reference/p5/draw) runs, the value from `frameCount % 290` is `2`, and `y2` becomes `238`.
755
755
- The third time [`draw()`](/reference/p5/draw) runs, the value in `frameCount % 290` is `3`, and `y2` becomes `237`.
756
-
- Once [`frameCount`](/reference/p5/framecount) becomes a number that is a multiple of `290`, the value in `frameCount % 290` is `0`, and `y2` is set back to its original value of `240`.
756
+
- Once [`frameCount`](/reference/p5/frameCount) becomes a number that is a multiple of `290`, the value in `frameCount % 290` is `0`, and `y2` is set back to its original value of `240`.
757
757
- This pattern continues until [`draw()`](/reference/p5/draw) is stopped.
758
758
759
759
Visit the following p5.js reference pages for more information: [`frameRate()`](/reference/p5/frameRate) | [`frameCount`](/reference/p5/frameCount) | [`triangle()`](/reference/p5/triangle)
0 commit comments