A Real Tree Looking A Bit Like A Fractal

Fractal Tree

Here's the code that runs the above animation.

You can change the code, if you like, and then click the following 'Reevaluate code' button. The program will then work as per your changes. Of course, your changes, especially random changes, can introduce errors, miscalculations, and browser crashes. If you need to get things back to their original condition, just reload this page using your browser's reload button.

The intention here is to conveniently show the inner workings of this program so that you understand how the diagram is drawn. Although there are library calls and custom objects in the code, the general logic of the fractal drawing is hopefully understandable. This program uses turtle geometry to draw the fractal.

Click the 'Code' button again to close this section.

Fractals are complex shapes based upon repeating patterns of other shapes.

These other, or inner, shapes are often quite simple, but when linked repeatedly in a patterned manner they generate a complex outer form. The inner repeating shapes are often similar to the outer original or general shape. This gives a fractal a look of repeating self similarity.

In the above program a simple 'v' shape is repeated again and again. At the tip of each branch of the 'v' a new inner 'v' is drawn. This new 'v' is smaller than the one from which whose branch tip it sprouts. This seems to form a figure that appears a bit like a tree or bush.

Starting size is the length of the first branch or trunk. It's the first and longest line drawn.

Minimum size is the smallest length that the repeating shapes shrink to.

Shrink factor is the multiplier that controls the size of the next inner shape relative to its immediate outer shape.

Angle controls the spreading of the tree branches.

Play with the number adjustment controls. Do minor changes at first.

Custom Search