Last active
March 19, 2017 14:06
-
-
Save cesine/a94908d0746605460121ee06eabb0ee1 to your computer and use it in GitHub Desktop.
Exported from Popcode. unit 10 topic 1 lesson 1 Click to import: https://popcode.org/?gist=a94908d0746605460121ee06eabb0ee1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Tiny Turtle</title> | |
<script src="https://toolness.github.io/tiny-turtle/tiny-turtle.js"></script> | |
</head> | |
<body> | |
<h1>Tiny Turtle</h1> | |
<canvas></canvas> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tiny Turtle Setup. Avoid modifying these lines of code! | |
var adjCanvasSize = document.getElementsByTagName('canvas')[0]; | |
adjCanvasSize.width = 400; | |
adjCanvasSize.height = 400; | |
TinyTurtle.apply(window); | |
// Start writing code here | |
function square(size){ | |
forward(50); | |
right(90); | |
forward(50); | |
right(90); | |
forward(50); | |
right(90); | |
forward(50); | |
right(90); | |
forward(50); | |
} | |
function triangle(size){ | |
forward(size); | |
right(120); | |
forward(size); | |
right(120); | |
forward(size); | |
right(120); | |
forward(size); | |
right(120); | |
forward(size); | |
} | |
function rectangle(size){ | |
forward(size); | |
right(90); | |
forward(size*2); | |
right(90); | |
forward(size); | |
right(90); | |
forward(size*2); | |
right(90); | |
forward(size); | |
} | |
function setRowGreen(){ | |
penStyle = "green"; | |
} | |
// Type your function call below | |
setRowGreen(); | |
stamp(40); | |
triangle(70); | |
rectangle(40); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
canvas { | |
border: 1px solid black; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment