Free Online Turtle Graphics : - Surf your logo code!
Turtle Graphics - Stroking and Filling Paths

[Index] [<< Previous section: Pen and Background Control] [Next section: Arcs and Shapes >>]

About paths. A path consists of a list of zero or more subpaths. Each subpath is a list of one or more points that are connected by straight or curved lines. Each subpath also contains a flag that indicates whether the subpath is closed. If a subpath is closed, the last point of the subpath is connected to the first point by a straight line. Subpaths that have fewer than two points are ignored when the path is painted.

Description: begins a new path, or resets the current path.
Description: deletes/cancels the current path.
Description: strokes/draws the current path with the current line/stroke color (default black).
Description: fills the current path with the current filling color (default white).
setfillcolor color
setfc color
Description: sets the filling color (default: white). The color can be set using standard color codes or html HEX values.
setfillcolor "red
setfillcolor "4
setfillcolor "#ff0000
Standard color codes: 0: "black" (
), 1: "blue" (
), 2: "lime" (
), 3: "cyan" (
), 4: "red" (
), 5: "magenta" (
6: "yellow" (
), 7: "white" (
), 8: "brown" (
), 9: "tan" (
), 10: "green" (
), 11: "aquamarine" (
), 12: "salmon" (
13: "purple" (
), 14: "orange" (
), 15: "gray" (

Example 1. The code bellow draws a triangle:

fd 100
left 90
fd 100

Example 2. The code bellow fills a rectangle:

fd 100
left 90
fd 150
left 90
fd 100
setfillcolor "blue

Example 3. The code bellow draws and fills a nice flower:

repeat 8 [
   make "c (random 16)
   setfillcolor :c
   repeat 2
   [ repeat 100 [fd 3 rt 1]
   rt 80 ]
   rt 45

• While drawing paths, the drawing mode is automatically set to "window".

[Index] [<< Previous section: Pen and Background Control] [Next section: Arcs and Shapes >>]
  1. Turtle Graphics section's content: Go to top
Get the new 2023 ebook!
(Surf Your Logo Code! - author: Vlad TUDOR)
Online Turtle Graphics - a free and modern web-based logo interpreter
Create an account now! It's EASY and FREE. Learn Logo & Turtle Graphics!
Find us on facebook
Get social with us!
World Map
Check other turtles
around the world!
Need help?
Browse our
support topics
Logo reference
Learn about your
turtle's language