Forked from Enrico's Pen Tiny Turtle.
A Pen by kawayne johnson on CodePen.
<canvas width=300 height=300></canvas> |
// Required | |
TinyTurtle.apply(window); | |
// Write a function called box that draws a box | |
// It should take one parameter, sideLength | |
function box(sideLength) { | |
forward(sideLength); | |
left(90); | |
forward(sideLength); | |
left(90); | |
forward(sideLength); | |
left(90); | |
forward(sideLength); | |
} | |
function triangle(sideLength) { | |
forward(sideLength); | |
right(120); | |
forward(sideLength); | |
right(120); | |
forward(sideLength) | |
} | |
// ...when your function is complete. This should work! | |
box(100); | |
triangle(50); | |
<script src="//toolness.github.io/tiny-turtle/tiny-turtle.js"></script> |
body { | |
background: gray; | |
text-align: center; | |
} | |
canvas { | |
background: white; | |
margin: 5vh 0 0; | |
width: 90vh; | |
} |
Forked from Enrico's Pen Tiny Turtle.
A Pen by kawayne johnson on CodePen.