Samples

This section has two collections of samples. The first group has samples to help you get started with programming in TurtleArt. Each of these samples has a small snippet of code illustrating some block or some related set of blocks.

The second group showcases 3 simple art projects. These projects are not just to be looked at and studied. You can modify them, rework them, remix them, in any way you can imagine.

To copy a project, just drag the image to your desktop. Then drag the image from the desktop to TurtleArt workspace.




Getting Started: Forward, Right, Arc, and Repeat


You make images in TurtleArt by combining blocks into stacks. Sometimes one stack, sometimes more. This section shows some simple stacks and the images that they produce.



forward 200 draws a line. Then back 200 retraces that line and brings you back to the starting point.
Repeat the line 10 times with right 36 in between. This makes a star with the lines evenly spaced. The total amount of turning is 10*36=360 degrees, the number of degrees in a circle.




forward 250 draws a line. back 200 retraces most of it. The Turtle doesn't quite get back to its starting point. Each line starts at a different position than the previous one.



You can name stacks. Pull out an empty hat block (the round yellow one). Click on it and type in a name. A new block to use that stack will appear in the blocks palette. In this sample, the square block isn't there when you start. It only appears after you have pulled out a hat and named it square.



You can make dashed lines with pen up and pen down.



An arc is a part of a circle. There are two inputs to the arc block: radius and angle. The radius is the size of the circle. The angle is how much of the circle to draw. An angle of 360 draws the whole circle.



Once you have an interesting element you can "spin" the element with a repeat and a right. In this case, the element is a double wave with each of the waves made with two arc blocks.



store in box1 lets you save a number. box1 recalls that number. You can use the boxes to make images that have repetiton with variation.



box1 can be used to create a succession of lines of increasing length. Put an angle between these lines and you get a square spiral.



You can fill areas with start fill and end fill. The blocks between start fill and end fill define the area to be filled.



Some randomness and some arithmetic lets you position elements. The element here is a dot made by forward 0.



Creating Art with TurtleArt


These samples illustrate some of the techniques for making art with TurtleArt. You can see the code in each sample by following the instructions for copying a project that appear near the start of this section.


Use setxy to position elements. This image use the star element twice.


This image uses a similar star element of the above example, and a dot element. Use set pensize and set shade to create radial gradients.


Use random to position and / or rotate elements, and to determine their size as well.