clearTurtleHistory
index
 
Name clearTurtleHistory ()
Description Deletes the history of the Turtle's movement. The next time draw() is called, all drawing that occured before clearTurtleHistory() is deleted.

The turtle maintains its current position and orientation. Only the path history is deleted.
Syntax clearTurtleHistory ();
Parameters
None  
Returns None
Example

      /* Draws a line at a random angle between 30 and 90 degrees. 
       * Clears drawing history and draws a new line each time a 
       * key is pressed. */

      import Turtle.*;
      Turtle t;

      void setup() {
        size(500,500);
        background(0);
        stroke(255);
        noLoop();
        t = new Turtle(this);
      }

      void draw () {
        background(0);
        t.right(random(30,90));
        t.forward(100);
        t.drawTurtle();
      }


      void keyPressed() {
          t.clearTurtleHistory();
          redraw();
      }