turtle-svg 0.1.1

Turtle graphics, SVG rendering
Documentation
  • Coverage
  • 73.86%
    65 out of 88 items documented0 out of 51 items with examples
  • Size
  • Source code size: 18.03 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.24 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • theobori/turtle-svg
    3 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • theobori

turtle-svg

How to build and run ?

  1. Install the dependencies
    • cargo

Usage example

use turtle_svg::{
    turtle::TurtleSvg,
    color::ColorPre
};

fn main() {
    let mut turtle = TurtleSvg::new();
    
    // Pen settings
    turtle.set_pen_size(5.);
    turtle.set_pen_color(ColorPre::Red);
    turtle.set_background_color(ColorPre::None);

    // Square
    turtle.forward(40.);
    turtle.right(90.);
    turtle.forward(40.);
    turtle.right(90.);
    turtle.forward(40.);
    turtle.right(90.);
    turtle.forward(40.);

    // Drawing size, name
    turtle.drawing_mut().set_size((300., 100.));
    turtle.drawing_mut().set_center((20., 20.));
    turtle.drawing_mut().save_svg("red_square.svg");
}

Documentation

Run cargo doc --open to read the documentation in the browser.