Turtle Drawing
Move turtles around, and make them draw.
Turtle movement commands control the speed and direction of the turtle movement. Drawing commands draw arcs, text, or fill areas.
BACK
Also: BK
Moves a turtle backwards.
Syntax
BACK number
Description
BACK moves the turtle in the opposite direction of its HEADING by the distance specified by its input. See also FORWARD.
The BACK command works slightly differently for a Blue-Bot robot.
Blue-Bot moves in fixed-size units. A value of 1 does not mean a single
pixel as the screen turtle, but one Blue-Bot movement unit, which is
about 6 inches (15 cm). If you, for example, use the command BACK 2
,
Blue-Bot will move backward one unit, stop briefly, and then move
backward a second unit.
The movement is limited to 100,000 pixels.
Example
BACK 50 BK 50
DISTANCE
Reports the distance between the turtle and a location.
Syntax
DISTANCE [x y]
Description
DISTANCE reports a number which is the distance in turtle steps from the first active turtle to the specified point. DISTANCE can be used to test how close a turtle is to another turtle, the mouse, or a target.
Example
ASK 1 [SETPOS [50 50] SHOWTURTLE] ASK 2 [SETPOS [0 50] SHOWTURTLE] DISTANCE ASK 1 [POS] Result: 70.71 DISTANCE ASK 2 [POS] Result: 50
DOT
Draws a dot.
Syntax
DOT [xcoordinate ycoordinate]
(DOT)
Description
DOT draws a dot at the specified location. When DOT has no input and is enclosed in parentheses, it draws a pixel at the location of the turtle. DOT draws a dot for each active turtle. If coordinates are given, the coordinates are relative to the origin and scale of each active turtle.
Example
TO RANDOM.DOTS :COUNT :AREA REPEAT :COUNT [DOT SENTENCE RANDOM :AREA RANDOM :AREA] END
SETPC “RED RANDOM.DOTS 300 50 </span>
DOT?
Also: DOTP
Tests whether a pixel with a color other than the background color is present.
Syntax
DOT?
(DOT? [xcoordinate ycoordinate])
Description
DOT? reports TRUE if the pixel identified by its argument has a color other than the background color. The coordinates are the coordinates of the first active turtle. If DOT is called with a coordinate pair as input (enclosed in parentheses), it uses the given coordinates relative to the origin and scale of the first active turtle.
Example
DOT [50 50] (DOT? [50 50]) Result: TRUE
DOTCOLOR
Reports the color of a pixel.
Syntax
DOTCOLOR [xcoordinate ycoordinate]
(DOTCOLOR)
Description
DOTCOLOR reports the color of the pixel identified by its argument. The color is reported as a list of Red, Green, and Blue values, or as a color name. When DOTCOLOR has no input and is enclosed in parentheses, it reports the color of the pixel under the first active turtle. If coordinates are used as input, the coordinates are screen coordinates, with [0 0] at the center.
FILL
Fills an area.
Syntax
FILL
(FILL color)
Description
FILL fills an area in the Graphics window. The area is filled in the current pen state, color, and pattern. FILL starts at the current turtle position and stops at a closed border of any color. If the turtle’s pen state is PENDOWN, FILL colors the area with the current pen color. If the pen state is PENERASE, FILL colors the area with the current background color, thus erasing the form. If the pen state is PENREVERSE, FILL colors the area with the complement of the current area color; for example, white turns to black, and green to red. If the turtle’s pen state is PENUP, FILL has no effect. If the pen width is set to 1 and the turtle is on a horizontal or vertical line, FILL changes the color of the line and other connected vertical and horizontal lines to the current pen color. If the line is at any other angle, FILL has no effect.
From Logo version 4.0.5 on, FILL accepts a color name, a color index, or a color value as an optional input. If FILL is called with an input, FILL fills all pixels until a boundary with the given color is found.
Example
SETWIDTH 2 SETPC “BLACK REPEAT 4 [FD 50 RT 90] PU RT 45 FD 20 PD FILL PU HOME
FONT
Reports the current font of the first active turtle.
Syntax
FONT
Description
The FONT command reports the current font of the first active turtle as a three element list consisting of the font name, the font size, and the font attributes.
Example
FONT Result: [Verdana 9 0]
FONTS
Reports a list of all loaded and available fonts.
Syntax
FONTS
Description
The FONTS command reports a list of all available fonts that can be used to print text in the Graphics panel using the TURTLETEXT command.
See also FONT, SETFONT and TURTLETEXT.
FORWARD
Also: FD
Moves a turtle forward.
Syntax
FORWARD number
Description
FORWARD moves the turtle in the direction of its HEADING by the distance specified by its input. See also BACK.
The FORWARD command works slightly differently for a Blue-Bot robot.
Blue-Bot moves in fixed-size units. A value of 1 does not mean a single
pixel as the screen turtle, but one Blue-Bot movement unit, which is
about 6 inches (15 cm). If you, for example, use the command
FORWARD 2
, Blue-Bot will move forward one unit, stop briefly, and then
moves forward a second unit.
The movement is limited to 100,000 pixels.
Example
FORWARD 50 FD 50
GETX
Also: XCOR
Reports the X coordinate of a turtle.
Syntax
GETX
Description
GETX outputs the X coordinate of the turtle’s position in the Graphics window. See also GETY, GETXY, SETX, SETY, and SETXY.
Example
GETX Result: 0
GETXY
Also: POS
Reports the coordinates of a turtle.
Syntax
GETXY
Description
GETXY reports a list consisting of the x and y coordinates of the turtle. GETXY is equivalent to POS. See also GETX, GETY, SETX, SETY, and SETXY.
Example
GETXY Result: [0 0]
GETY
Also: YCOR
Reports the Y coordinate of a turtle.
Syntax
GETY
Description
GETY outputs the Y coordinate of the turtle’s position in the Graphics window. See also GETX, GETXY, SETX, SETY, and SETXY.
Example
GETY Result: 0
HEADING
Reports the heading of a turtle.
Syntax
HEADING
Description
HEADING reports the turtle’s heading, a number between 0 and 360, representing the turtle’s angle from the straight up position. Straight up is 0, to the right is 90, down is 180, and to the left is 270.
Use SETHEADING to set the turtle’s heading.
Example
TO NAUTILUS RT 10 FORWARD HEADING BACK HEADING IF HEADING < 90 THEN NAUTILUS END
NAUTILUS </span>
HIDETURTLE
Also: HT
Hides a turtle.
Syntax
HIDETURTLE
Description
HIDETURTLE makes the turtle shape invisible. To make the turtle visible, use SHOWTURTLE. See also SHOWN?.
HOME
Moves the turtle back to [0 0].
Syntax
HOME
Description
HOME moves the turtle to the center of the screen and points the turtle straight up without clearing the graphics screen or altering the pen state. Typing HOME is equivalent to entering SETXY [0 0] SETHEADING 0.
Example
DRAW TO HEART REPEAT 10 [FD 5 RT 18] REPEAT 22 [FD 3 RT 3] PU HOME PD REPEAT 10 [FD 5 LT 18] REPEAT 22 [FD 3 LT 3] HT END HEART defined HEART
LEFT
Also: LT
Turns a turtle left.
Syntax
LEFT number
Description
LEFT rotates the turtle left (counterclockwise) the number of degrees specified in its input. See also RIGHT.
Example
LEFT 45
ORIGIN
Reports the origin of a turtle’s coordinate system.
Syntax
ORIGIN
Description
The ORIGIN command reports the coordinate system origin of the first active turtle in the form of a list with two integers: the first integer is the X value and the second integer is the Y value. The coordinates reported by ORIGIN are relative to the standard turtle coordinate system, where [0 0] is the center of the window. See also SETORIGIN.
Example
CS ASK 0 [SETPOS [-25 0] SETORIGIN POS] ASK 1 [SETPOS [25 0] SETORIGIN POS] TELL [0 1] FD 50 RT 135 FD 36 HOME ASK 0 [ORIGIN] Result: [-25 0] ASK 1 [ORIGIN] Result: [25 0]
PANGLE
Reports the turtle’s angle as a polar angle.
Syntax
PANGLE
Description
Polar coordinates describe positions on a plane in terms of the distance from the turtle’s home in the center of the Graphics window and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading equivalent to 3 o’clock.
PDIST
Reports the distance from the turtle to its home.
Syntax
PDIST
Description
PDIST reports the distance from the turtle to its home in the center of the Graphics window. Polar coordinates describe positions on a plane in terms of the distance from the turtle’s home in the center of the Graphics window and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading equivalent to 3 o’clock.
PEN
Reports the pen mode.
Syntax
PEN
Description
PEN reports the pen mode of the current turtle. Available modes are PENDOWN, PENUP, PENERASE, and PENREVERSE.
Example
DRAW PEN
PENDOWN
Also: PD
Puts the pen down.
Syntax
PENDOWN
Description
PENDOWN puts the turtle’s pen down and causes the turtle to draw a line when it moves. Used in conjunction with PENUP. DRAW puts the pen down. See also PENDOWN?, SETPEN, PENERASE, and PENREVERSE.
PENDOWN?
Also: PENDOWNP
Checks whether the pen is down.
Syntax
PENDOWN?
Description
PENDOWN? reports TRUE if the pen of the current turtle is in a drawing mode. Thus, it reports TRUE if the pen is set to PENDOWN, PENERASE, or PENREVERSE mode, where the turtle may affect the graphics when it moves. When the pen is set to PENUP mode, PENDOWN? reports FALSE.
Example
PENDOWN PENDOWN? Result: TRUE PENUP PENDOWN? Result: FALSE PENERASE PENDOWN? Result: FALSE
PENERASE
Also: PE
The pen draws with the background color.
Syntax
PENERASE
Description
PENERASE turns the turtle’s pen into an eraser. When the turtle moves, it appears to erase by drawing in the current background color. To stop PENERASE, use PENDOWN, PENUP, PENERASE, or SETPEN.
PENREVERSE
Also: PX
The pen inverts all colors.
Syntax
PENREVERSE
Description
PENREVERSE inverts the background color when the turtle moves. The combination creates many possible effects. The exact appearance of the screen depends on the color of the background where the turtle draws.
DRAW puts the pen down. See also SETPEN, PENDOWN, PENUP, and PENERASE.
PENUP
Also: PU
The pen moves up.
Syntax
PENUP
Description
PENUP puts the turtle’s pen up. When the turtle moves, it does not draw a line. Used in conjunction with PENDOWN. See also PENDOWN?, PENERASE, and PENREVERSE.
PHEADING
Reports the turtle’s polar heading.
Syntax
PHEADING
Description
Polar coordinates describe positions on the plane in terms of the distance from the turtle’s home and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading that is equivalent to 3 o’clock.
PHEADING reports the polar heading of the turtle. A heading of 0 degrees is equivalent to a Cartesian heading of 90 degrees. Set the polar heading with PSETHEADING.
See also SETP, PPOS, PANGLE, and PDIST.
Example
SETP 35 60 PSETH 180 PHEADING Result: 180
PPOS
Reports the turtle’s polar position.
Syntax
PPOS
Description
PPOS reports the turtle’s polar position, a list of two numbers: the distance from home and the polar angle. Set the polar position using SETP. Polar coordinates describe positions on a plane in terms of the distance from the turtle’s home in the center of the Graphics window and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading equivalent to 3 o’clock. See also PHEADING, PANGLE, and PDIST.
PSETHEADING
Also: PSETH
Sets the polar heading of a turtle.
Syntax
PSETHEADING number
PSETH number
Description
Polar coordinates describe positions on the plane in terms of the distance from the turtle’s home and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading that is equivalent to 3 o’clock. PSETHEADING sets the polar heading of the turtle. A polar heading of 0 degrees is equivalent to 90 degrees in the turtle’s normal (Cartesian) coordinate system. PHEADING reports the polar heading. See also SETP, PPOS, PANGLE, and PDIST.
Example
SETP 35 60 PSETH 180 PHEADING Result: 180
RIGHT
Also: RT
Turns a turtle right.
Syntax
RIGHT number
Description
RIGHT rotates the turtle right (clockwise) the number of degrees specified in its input. See also LEFT.
Example
RIGHT 45
SETFONT
Sets the turtle drawing font.
Syntax
SETFONT name size attributes
(SETFONT name size)
(SETFONT name)
(SETFONT)
(SETFONT [name size attributes])
(SETFONT [name size])
(SETFONT [name])
(SETFONT [])
Description
SETFONT defines the turtle font. The first input is the font name. This font should be present in the system. If the font is not present, the operating system selects a similar font for you. The second input is the font size, given in points, while the third is a combination of the following values:
0 | regular |
1 | bold |
2 | italic |
4 | underlined |
SETFONT can also be called with fewer than three inputs; in that case, the parts of the font that are not supplied are left unchanged. Calling SETFONT with no inputs causes the font to be reset to the default turtle font. Also, calling SETFONT with a list of zero to three elements makes it possible to match the output of FONT with the input to SETFONT. See also FONT, FONTS and TURTLETEXT.
Example
SETFONT “TIMES 14 1 TT “HELLO
SETHEADING
Also: SETH
Sets the heading of a turtle.
Syntax
SETHEADING number
Description
SETHEADING turns the turtle to the degree position specified by its input. Positive numbers turn the turtle clockwise.
SETHEADING turns the turtle according to the direction of the window and not the current heading of the turtle. SETHEADING 0 always points the turtle straight up, regardless of the direction in which it is pointing.
To output the turtle’s heading, use HEADING.
Example
TO NAUTILUS RT 10 FORWARD HEADING BACK HEADING IF HEADING < 90 THEN NAUTILUS END
NAUTILUS </span>
SETORIGIN
Sets the coordinate system origin of the active turtles.
Syntax
SETORIGIN xy
SETORIGIN [x y]
(SETORIGIN)
Description
The SETORIGIN command allows the coordinate system origin point to be set for active turtles. Normally, the coordinate system origin (location [0 0]) is at the center of the window. This origin may be changed for all turtles or individually for any turtle.
The input for SETORIGIN is a list of two integers, an X value and a Y value. The coordinates are always relative to the standard turtle coordinate system, where [0 0] is the center of the window. If you supply a single number, it sets both the X and Y coordinates. (SETORIGIN) resets the origin to the center of the window.
Each turtle, control, or bitmap can have its own origin on the screen.
See also ORIGIN, SETEXTENT and EXTENT.
Example
ASK 1 [SETXY [25 0] SETORIGIN POS] TELL [0 1] ST FD 50 RT 135 FD 36 HOME
SETP
Sets the turtle’s polar position.
Syntax
SETP distance angle
Description
SETP sets the turtle’s polar position. It takes two inputs: a distance and a polar angle. It aims the turtle at the specified polar heading and moves it forward the specified distance. Polar coordinates describe positions on a plane in terms of the distance from the turtle’s home in the center of the Graphics window and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading equivalent to 3 o’clock. See also PHEADING, PANGLE, and PDIST.
SETPEN
Sets the pen characteristics.
Syntax
SETPEN [penstate pencolor]
Description
SETPEN changes the state of the turtle’s pen and the pen color as specified by its input list. The first element of the list can be PENUP, PENDOWN, PENERASE, or PENREVERSE. The second element is a number from 0 to 163 (the index of a color name that the COLORS procedure returns, a color word or a list of three RGB values, which specifies the pen color. Use PEN to output the current turtle’s pen state and PENCOLOR to output the current turtle’s pen color. See also SETPC.
Example
SETPEN [PENDOWN RED] FD 50
SETSPEED
Sets the speed at which turtle commands are executed.
Syntax
SETSPEED number
Description
SETSPEED determines the speed at which the turtles move on the screen when being issued a movement command. SETSPEED accepts a number from 0.1 to 1 as an input. A speed of 1 is the fastest speed and 0.1 is the slowest. When Logo starts, the turtle speed is 1. SETSPEED slows down the execution speed of any movement commend. To retrieve the current speed, use SPEED.
SETSPEED interacts with the SETVELOCITY command. IF you
call SETSPEED, the turtle stops moving independently. Both SETSPEED and
SETVELOCITY set the value of the turtle’s CRAWL
property.
Example
SETSPEED 0.5 FD 100 SETSPEED 1
SETSTEPSIZE
Sets the step size of all active turtles and bitmaps.
Syntax
SETSTEPSIZE pixels
Description
SETSTEPSIZE sets the distance, in pixels, that Logo turtles and bitmaps move with each FORWARD or BACK command. SETSTEPSIZE sets this value for all currently active Logo turtles and bitmaps. By default, each Logo turtle and bitmap moves in steps of one pixel.
To obtain the step size for a turtle or bitmap, use STEPSIZE.
Example
FD 10 SETSTEPSIZE 10 FD 10 SETSTEPSIZE 1 BK 110
SETTURTLESIZE
Also: SETTSIZE, SETTS
Sets the size of a turtle.
Syntax
SETTURTLESIZE number
Description
SETTURTLESIZE sets the size of the turtle. The input number must be in the range of 0.01 to 99, where 0.01 indicates an almost invisibly small turtle, and 99 the largest possible turtle. As the size of the turtle increases, its shape becomes more jagged. The SETTURTLESIZE command calculates the new size of the turtle using the original size of the turtle shape. The command PPROP 0 “SIZE [100 200] alters the size of turtle 0 as well, using the given values. The command TURTLESIZE reports the size of the current turtle.
Example
TELL [0 1 2] ST EACH [PU SETX 100 * WHO SETTURTLESIZE WHO + 1]
SETVELOCITY
Sets the independent speed of a turtle.
Syntax
SETVELOCITY number
Description
SETVELOCITY sets the speed at which a turtle moves on the screen. Setting a speed other than 0 causes the turtle or the bitmap to start moving with a speed of approximately the number of dots given as input per second. See also VELOCITY.
SETVELOCITY interacts with the SETSPEED command. IF you
call SETVELOCITY, the turtle stops moving slowly. Both SETSPEED and
SETVELOCITY set the value of the turtle’s CRAWL
property.
Example
SETVELOCITY 100 WAIT 1000 RT 20 WAIT 1000 RT 50 WAIT 1000 SETVELOCITY 0
SETWIDTH
Also: SETW
Sets the pen width.
Syntax
SETWIDTH number
Description
SETWIDTH defines the width of the line drawn by all active turtles. SETWIDTH takes a number between 1 and 99 as input. WIDTH reports the current line width. See also PENDOWN ,PENREVERSE, and PENERASE.
Example
(FOR “W 30 1 [SETWIDTH :W PD FD 3] -1)
SETX
Sets the X coordinate of a turtle.
Syntax
SETX x-coordinate
Description
SETX moves the turtle horizontally to the point specified by the input number. SETX does not affect the turtle’s heading or its Y coordinate. See also SETY, SETXY, GETX, GETY, and GETXY.
Example
HOME SETX 45
SETXY
Also: SETPOS
Sets the coordinates of a turtle.
Syntax
SETXY [x-coordinate y-coordinate]
Description
SETXY moves the turtle to the point specified by its inputs. SETXY does not affect the turtle’s heading. To obtain the X and Y coordinates of the turtle, use GETXY or the equivalent command, POS. SETXY accepts a two-element list of coordinates.
See also SETX, SETY, GETX, GETY, and GETXY.
Example
HOME SETXY [50 50]
SETY
Sets the Y coordinate of a turtle.
Syntax
SETY y-coordinate
Description
SETY moves the turtle vertically to the point specified by the input number. SETY does not affect the turtle’s heading or its X coordinate. See also SETX, SETXY, GETX, GETY, and GETXY.
Example
HOME SETY 45
SHOWN?
Also: SHOWNP
Reports whether a turtle is visible.
Syntax
SHOWN?
Description
SHOWN? reports TRUE if the first active turtle is currently displayed on the graphics screen; otherwise, it reports FALSE. See also HIDETURTLE, and SHOWTURTLE.
SHOWTURTLE
Also: ST
Makes a turtle visible.
Syntax
SHOWTURTLE
Description
SHOWTURTLE makes the turtle shape visible. To make the turtle invisible, use HIDETURTLE. See also SHOWN?.
SLOWTURTLE
Slows down the turtle to half speed.
Syntax
SLOWTURTLE
Description
SLOWTURTLE slows down the execution speed of any movement commend. It is equivalent to the command SETSPEED 0.5. To have the turtles and bitmaps move independently, use the SETVELOCITY command.
To retrieve the current speed, use SPEED.
Example
SLOWTURTLE SPEED Result: 0.5 SETSPEED 1
SPEED
Reports the speed in which turtle commands are executed.
Syntax
SPEED
Description
SPEED reports the current speed at which the turtle(s) moves on the screen. When Logo starts, the turtle speed is 1. Values range from 0.1 to 1; the lower the value is, the slower the turtle moves. Use SETSPEED to change the speed.
Example
SPEED Result: 1
STAMPOVAL
Draws an oval.
Syntax
STAMPOVAL xradius yradius
(STAMPOVAL xradius yradius "TRUE)
Description
STAMPOVAL draws an oval around the current turtle(s). It takes two numbers as inputs. The first input is the oval’s radius in the horizontal direction; the second input is its radius in the vertical direction. STAMPOVAL draws a circle if the two inputs are equal. If STAMPOVAL, its inputs, and the value TRUE are all enclosed in parentheses, the oval drawn is filled with the current pattern in the current pen color. If the turtle’s pen state is PENDOWN, STAMPOVAL colors the area with the current pen color. If the pen state is PENERASE, STAMPOVAL colors the area with the current background color, thus erasing the form. If the pen state is PENREVERSE, STAMPOVAL colors the area with the complement of the current area color; for example, white turns to black, and green to red. If the turtle’s pen state is PENUP, STAMPOVAL has no effect. See also STAMPRECT.
Example
STAMPOVAL 100 100 (STAMPOVAL 50 50 TRUE)
STAMPRECT
Draws a rectangle.
Syntax
STAMPRECT width height
(STAMPRECT width height "TRUE)
Description
STAMPRECT draws a rectangle with a width in turtle steps defined by its first input and a height defined by its second input. The rectangle is drawn with the current turtle position in the lower left corner. STAMPRECT draws a square if the two inputs are equal. If STAMPRECT, its inputs, and the value TRUE are all enclosed in parentheses, the rectangle drawn is filled with the current pattern in the current pen color. If the turtle’s pen state is PENDOWN, STAMPRECT colors the area with the current pen color. If the pen state is PENERASE, STAMPRECT colors the area with the current background color, thus erasing the form. If the pen state is PENREVERSE, STAMPRECT colors the area with the complement of the current area color; for example, white turns to black, and green to red. If the turtle’s pen state is PENUP, STAMPRECT has no effect. See also STAMPOVAL.
Example
SETPC “RED (STAMPRECT 40 60 “TRUE) PU SETX 75 PD SETPC “SILVER (STAMPRECT 40 60 “TRUE) STAMPRECT 40 60
STEPSIZE
Outputs the step size of the first active turtle or bitmap.
Syntax
STEPSIZE
Description
STEPSIZE outputs the distance, in pixels, that Logo turtles and bitmaps move with each FORWARD or BACK command, for the first active turtle or bitmap. By default, each Logo turtle and bitmap moves in steps of one pixel.
Example
FD 10 SETSTEPSIZE 10 FD 10 STEPSIZE
TOWARDS
Reports the angle of a position compared to the turtle position.
Syntax
TOWARDS [xcoordinate ycoordinate]
Description
TOWARDS reports a number that is the heading that will point the turtle to the position specified by its input list. SETHEADING TOWARDS [xcoordinate ycoordinate] heads the turtle in the direction of its input list.
Example
ST SETH 0 SETH TOWARDS [100 100]
TURTLESIZE
Also: TSIZE
Reports the size of a turtle.
Syntax
TURTLESIZE
Description
TURTLESIZE reports a number, the size of the current turtle. A turtle’s size can be in the range of 0.1 to 99, which corresponds to the scale of the turtle shape. Note that the size is reported as (real height) / (original height). If the size of a turtle was altered using the command PPROP turtle “SIZE, the TSIZE command ignores the width of the turtle. To set the turtle’s size, use SETTURTLESIZE.
TURTLETEXT
Also: TT
Prints its input on the Graphics window.
Syntax
TURTLETEXT whatToPrint
Description
TURTLETEXT prints its input (word or list) on the Graphics window at the position of the current turtle. TURTLETEXT prints in the pen color and font of the current turtle. TURTLETEXT has no effect if the turtle’s pen is up.
To get the dimensions of the printed text, see TURTLETEXTSIZE. To get the baseline offset of the current font, see TURTLETEXTBASE. See also FONT, SETFONT, TURTLETEXTSIZE and FONTS.
Example
TURTLETEXT [HELLO WORLD]
TURTLETEXTBASE
Also: TTBASE
Outputs the baseline offset of the first listening turtle’s font.
Syntax
TURTLETEXTBASE
TTBASE
Description
The TURTLETEXT command draws text using the bounding text box, and the turtle positioned at the top left corner of that box. When drawing text in different sizes, you would want to align the text at the baseline of that font. The baseline is the imaginary line that you would use to write on if you wrote the text yourself.
To get the size of the bounding box of a text, see TURTLETEXTSIZE. See also FONT, SETFONT, and FONTS.
Example
; assume that the baseline is at 0 DRAW PU SETH 90 SETFONT “TIMES 22 0 SETY TTBASE PD TT “|Logo | PU FD FIRST TTSIZE “|Logo | SETFONT “TIMES 14 0 SETY TTBASE PD TT “|Logo| PU FD FIRST TTSIZE “|Logo|
TURTLETEXTSIZE
Also: TTSIZE
Outputs the dimensions of a text drawn with the first listening turtle.
Syntax
TURTLETEXTSIZE "text
TTSIZE "text
Description
The TURTLETEXTSIZE command is convenient if you want to erase the background before drawing a text, or if you want to advance the turtle behind or below the text after drawing a text. To align text with different sizes, see TURTLETEXTBASE.
See also FONT, SETFONT and FONTS.
Example
; assume that the baseline is at 0 DRAW PU SETH 90 SETFONT “TIMES 22 0 SETY TTBASE PD TT “|Logo | PU FD FIRST TTSIZE “|Logo | SETFONT “TIMES 14 0 SETY TTBASE PD TT “|Logo| PU FD FIRST TTSIZE “|Logo|
VELOCITY
Reports the independent movement speed of a turtle.
Syntax
VELOCITY
Description
VELOCITY reports the current speed at which the turtles move on the screen. This speed is approximately the number of pixels (dots) turtles move per second. When Logo starts, the turtle velocity is 0. Use SETVELOCITY
to change the velocity.
Example
VELOCITY Result: 0
WIDTH
Reports the pen width.
Syntax
WIDTH
Description
WIDTH reports the pen width of the first active turtle. The pen width can be a number between 1 and 99. The pen width is set using the command SETWIDTH. If more than one turtle is active, the pen width of these turtles may be interrogated with WIDTH and the ASK or EACH command.
Example
DRAW WIDTH Result: 1 TELL [0 1 2 3 4] SETWIDTH 5 EACH [PRINT WIDTH] 5 5 5 5 5