Chapter 02 - Lesson 02

Drawing One Branch

Treat one line segment as the smallest unit of the whole tree.

Concept explanation

A fractal tree starts as one branch: a line with a start point, a length, and a thickness. Everything later repeats this unit at new angles and smaller sizes.

Try it

Treat one line segment as the smallest unit of the whole tree.

Code fragment

strokeWeight(thickness);
line(startX, startY, startX, startY - length);

What to observe

  • The branch grows upward because the y value decreases.
  • Thickness makes the line read as a trunk.
  • The whole tree is built from this unit.

Small challenge

Compare a single trunk with the recursive version in the next lesson.