Skip to content

Instantly share code, notes, and snippets.

@alexpelan
Created December 3, 2017 23:26
Show Gist options
  • Save alexpelan/2724c41f6fa090ab25d2d7b33ec11bee to your computer and use it in GitHub Desktop.
Save alexpelan/2724c41f6fa090ab25d2d7b33ec11bee to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=2724c41f6fa090ab25d2d7b33ec11bee
  1. In your HTML, give your page a title <title> Function Declaration </title>
  2. Create a square(); function that draws a square and call it four times to create four squares next to each other.
  3. Create a rectangle(); function that draws a rectangle. Call it two times.
<!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>
{"hiddenUIComponents":["editor.css"]}
// Tiny Turtle Setup. Avoid modifying these lines of code!
var adjCanvasSize = document.getElementsByTagName('canvas')[0];
adjCanvasSize.width = 400;
adjCanvasSize.height = 400;
TinyTurtle.apply(window);
canvas {
border: 1px solid black;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment