Pencil Code Reference > home

 

home returns turtle to the center of the page

home returns the turtle to the starting position and scales it back to its original size.

home acts almost like the jumpto, turnto, and scale commands all in one command.

Using each command individually would look something like this:

jumpto 0, 0
turnto 0
scale 1/x

home can be used to make symmetrical shapes and graphics.


dot red
label "home", 'top'
p = pen brown, 2
p.bk 30
p.home()

Drawing Shapes

home can be used to create intricate drawings where the center of the shape is the focus, e.g. flowers.

In this example, we will create an arrow shape. Notice that we move backwards from the center of the page to draw the arrow.

dot blue
label "home", 'top'
p = pen red, 2
p.bk 30
p.lt 45
p.bk 30
p.pause 1
p.home()
p.rt 45
p.bk 30
p.pause 1
p.home()
p.bk 40

You can use jumpto to make the turtle jump to specific x and y coordinates on a page.