Create Animated Drawings in Rust
Clone or download
Permalink
Failed to load latest commit information.
docs Update docs to latest version of turtle Aug 15, 2018
examples Better background colors for examples Aug 15, 2018
src Add is_filling() method. Aug 21, 2018
web Revert "Starting to duplicate some of the Rust logic in JS" Aug 15, 2018
.ackrc Added .ackrc and .gitignore Sep 27, 2017
.gitignore Minimal amount of work to get the program to compile into wasm Aug 15, 2018
.rustfmt.toml Running rustfmt Aug 15, 2018
.travis.yml Always printing out the rustc version May 18, 2018
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Dec 7, 2017
CONTRIBUTING.md Fixes #4. Completed CONTRIBUTING.md Aug 8, 2018
Cargo.toml Fix cargo doc warning by explicitly matching /README.md in Cargo.toml Aug 18, 2018
LICENSE Mozilla Public License Dec 5, 2017
README.md Fixes #47. Made all links permanent. Aug 15, 2018
RELEASE_CHECKLIST.md Updating release checklist to use new docs folder Jun 1, 2018
appveyor.yml Removing rust-toolchain file in CI so we use the correct rustc version May 18, 2018
build-wasm Really nice build script for generating WASM Aug 15, 2018
circle.gif Replaced multiple pictures with a gif in README Oct 27, 2017
forward.gif Replaced multiple pictures with a gif in README Oct 27, 2017
perf-flame Scripts for performance profiling and statistics Oct 27, 2017
perf-stat Using perf with debug profile now instead of release (since that's ho… Oct 27, 2017
rust-toolchain Added rust-toolchain file to make sure we run on stable by default Nov 23, 2017

README.md

turtle

Crates.io Docs.rs Crates.io Crates.io Build Status Build status Gitter Say Thanks!

Tweet your drawings to us on Twitter at @RustTurtle and follow us to see what is being created!

Create animated drawings with the Rust programming language. This crate is a tool for teaching programming by drawing pictures. Learning this way is fun and interesting for people of all ages!

The idea: You control a turtle with a pen tied to its tail. As it moves across the screen, it draws the path that it follows. You can use this to draw any picture you want just by moving the turtle across the screen.

turtle moving forward

Documentation

Example

As a simple example, you can draw a circle with only the following code:

extern crate turtle;

use turtle::Turtle;

fn main() {
    let mut turtle = Turtle::new();

    for _ in 0..360 {
        // Move forward three steps
        turtle.forward(3.0);
        // Rotate to the right (clockwise) by 1 degree
        turtle.right(1.0);
    }
}

This will produce the following:

turtle drawing a circle

See the examples/ directory for more examples of how to use this crate.

Need help?

The following are some resources you can use to find help when you run into a problem. The links are listed in the order you should try each one, but feel free to come to the Turtle Gitter anytime if you are lost.

Contributing

See CONTRIBUTING.md for information about contributing to this project including how to build and test the project, submit new examples, report bugs, and more.

Inspiration & Goals

This crate is inspired by the Logo educational programming language. Many languages contain implementations of Logo's "turtle graphics". For example, the Python programming language comes with a built-in turtle module. This crate is largely inspired by the Python implementation, but uses Rust conventions and best practices to provide the best possible platform for learning Rust.

The goal of this crate is to be as easy to approach as possible and also provide the opportunity to explore Rust's most advanced features. We welcome contributions from anyone and everyone, including those that are new to the Rust programming language.