SVG Turtle Back End

The SVG turtle back end is used to produce Scalable Vector Graphics from turtle commands. A line drawn by the turtle will be represented by the appropriate markup in SVG.

The SVG turtle is meant to be used in a non-interactive batch mode. The -f command line argument should be used to select a Logo program that contains turtle commands. For interactive exploration while developing images, use the GUI turtle back end.

The SVG turtle can be directed to write its results to a single SVG file using the -o command line option. The SVG image can then be used in applications, such as web browsers, which support SVG.

Because SVG enjoys such robust web browser support, the turtle can also be instructed to create a minimal web page that animates the SVG image so that it appears to be drawn on the page. The --html command line option can be used to specify a folder that the generated content will be placed into. The animation uses the vivus.js JavaScript library to animate the content.

Note

Vivus.js uses a different license than logopy. While logopy uses the GPLv3 license, vivus.js uses the MIT license. As a user of the software, this probably won’t make much difference to you. If you plan on distributing the software, you may want to review your obligations under the different licenses.

There are additional command line options that allow you to influence the behavior of the animations:

  • --html-title allows you to set the web page title.
  • --html-width allows you to set the width of the image to be displayed in pixels.
  • --html-scale allows you to specify the width of the image as a percentage of the total screen width.
  • --animation-duration allows you to specify the animation duration in frames (see vivus documentation).
  • --animation-type allows you to specify the animation type (see the vivus documentation).
  • --animation-start allows you to specify if the animation should start automatically (automatic) or when the image scrolls into the viewport (inviewport).

Examples of SVG images created with the SVG turtle can be seen in the Logopy Gallery .