On this page:
draw
draw-custom
draw-step-by-step
draw-step-by-step-custom
draw-and-store
draw-and-store-custom
6.3.90.900

3 Drawing functions for Racket Turtle

procedure

(draw command-list)  image?

  command-list : (list-of procedure)
Reads and executes the commands in command-list and returns the created picture. Opens animation window and shows the turtle in action.

procedure

(draw-custom command-list width height speed)  image?

  command-list : (list-of procedure)
  width : (and/c positive? real?)
  height : (and/c positive? real?)
  speed : (and/c positive? real?)
Set the animation window’s size to width and height and the drawing speed to (speed. If speed is set to value 0, default speed is used. The default size of the animation window is 500 x 500 pixels.

procedure

(draw-step-by-step command-list)  image?

  command-list : (list-of procedure)
Like draw but command-list is processed step-by-step. Each step is performed after user has pressed the spacebar. Notice that changing for example turtle’s pen color is one step, so turle doesn’t necessarity move each time.

procedure

(draw-step-by-step-custom command-list    
  width    
  height    
  speed)  image?
  command-list : (list-of procedure)
  width : (and/c positive? real?)
  height : (and/c positive? real?)
  speed : (and/c positive? real?)
Like draw-custom but command-list is processed step-by-step. Each step is performed after user has pressed the spacebar. Notice that changing for example turtle’s pen color is one step, so turle doesn’t necessarity move each time.

procedure

(draw-and-store command-list)  image?

  command-list : (list-of procedure)
Like draw but stores an animated gif of the animation in a folder called turtle_animations. This folder has to be located in the same path as the .rkt file. If this folder is missing, animated gif file is not created. Notice that the creation of the file takes some time so don’t close the animation window before the text "Creating animated gif" has disappeared and the final image is shown again.

Note! WeScheme doesn’t support this.

procedure

(draw-and-store-custom command-list    
  width    
  height    
  speed)  image?
  command-list : (list-of procedure)
  width : (and/c positive? real?)
  height : (and/c positive? real?)
  speed : (and/c positive? real?)
Like draw-custom but stores animation as an animated gif-file.

Note! WeScheme doesn’t support this.