Skip to content

joside/jsTurtle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Documentation

- Create a canvas
    Example:
    <canvas id="mycanvas" width="800" height="800"></canvas>

- Create a Turtle
    Example:
    var canvas = document.getElementById('mycanvas');
    if (canvas.getContext) {
        turtle = new Turtle(canvas.getContext('2d'));
    }
    
- Start drawing
    Example:
    turtle.pd().fd(10).lt(45).fd(10).pu();
    
- Implemented commands for now:
    fd(x): move (and paint if pen is down) forward x pixel
    lt(x): turn left by x degrees,
    rt(x): turn right by x degrees,
    pu(): penUp, means that the turtle won't draw,
    pd(): penDown, means that the turtle will draw
    
- planned:
    cp(color): change color of pen,
    bd(x): move backward (fd(-x))

About

A HTML5 Canvas Turtle Implementation, no additional Libraries needed. First preview (not fully based on this source) on

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published