turtle 1.0.0-rc.3

Learn the Rust language by creating animated drawings!
Documentation
---
layout: default
---
<link rel="stylesheet" href="{{ "/assets/css/home.css" | relative_url }}">

<section class="headline-section">
  <div class="wrapper">
    <div class="section-text">
      <div class="headline">
        Create Animated Drawings Quickly and Easily in Rust
      </div>
      <p class="tagline">
        Get started immediately and produce your first drawing within minutes.
        This crate is an excellent tool for learning and teaching the
        <a href="https://www.rust-lang.org" target="_blank">Rust programming language</a>.
        Anyone of any age or skill level can learn how to create art with code!
      </p>
    </div>

    <div class="start-learning">
      <a class="btn btn-lg btn-primary" href="{% link guide/index.md %}">Let's Get Started!</a>
    </div>

    <img class="rust-drawing" src="{{ "/assets/images/rust.gif" | relative_url }}" />
  </div>
</section>

<section class="home-section">
  <div class="wrapper">
    <h2>The Basic Concept</h2>
    <div class="section-text">
      <p>You control a turtle with a pen tied to its tail. As it moves across
        the screen, it draws the path that it follows. Change the turtle's
        speed, its pen's color, and more to create more complex drawings and
        animations.</p>
      <p>This simple mental model is all you need to draw
        all kinds of pictures!</p>
    </div>
    <div class="section-image">
      <img src="{{ "/assets/images/circle-square.gif" | relative_url }}" />
    </div>
  </div>
</section>

<section class="home-section">
  <div class="wrapper">
    <h2>Easy to Learn Graphics</h2>
    <div class="section-text">
      <p>We designed Turtle to be incredibly easy to learn and user friendly.
        We leverage the power of Rust's advanced type system to make using Turtle
        as convenient for you as possible.</p>

        <p>Use different colors, fills and other options to create anything you
          want! Turtle supports lots of different drawing commands so you can
          get really creative!</p>
    </div>
    <div class="section-code">
{% highlight rust linenos %}
// This program draws a triangle
let mut turtle = Turtle::new();
turtle.set_pen_color("red");
turtle.set_fill_color("orange");
// Turn right 30 degrees
turtle.right(30.0);
for _ in 0..3 {
  // Walk forward 150 steps
  turtle.forward(150.0);
  // Turn right 120 degrees
  turtle.right(120.0);
}
{% endhighlight %}
    </div>
  </div>
</section>

<section class="home-section">
  <div class="wrapper">
    <h2>Go From Basic To Advanced</h2>
    <div class="section-text">
      <p>Start from the most basic concepts, then quickly work your way up
        as you learn to draw more complex things.</p>
{% highlight rust linenos %}
// Draws what looks like several nested cubes
for i in 0..290 {
    let i = i as f64;
    turtle.set_pen_color(Color {
        red: (i / 300.0 * 4.0) * 255.0 % 255.0,
        green: 255.0, blue: 255.0, alpha: 1.0,
    });
    turtle.forward(i);
    turtle.right(60.0);
}
{% endhighlight %}
    </div>
    <div class="section-image">
      <img src="{{ "/assets/images/nestedcubes.gif" | relative_url }}" />
    </div>
  </div>
</section>