-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.htm
More file actions
71 lines (67 loc) · 1.85 KB
/
Copy pathtest.htm
File metadata and controls
71 lines (67 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html>
<head>
<title>Turtle Graphics - Test Page</title>
<meta charset="utf-8">
<script type='text/javascript' src='turtle.js'></script>
</head>
<body>
<h2>Turtles on Canvas</h2>
<canvas id="screen" width="384" height="256" style="background-color: black; border: 1px solid black">
Canvas not supported on this browser
</canvas>
<script>
var t = new Turtle("screen");
function Square()
{
t.fd(100);
t.rt(90);
t.fd(100);
t.rt(90);
t.fd(100);
t.rt(90);
t.fd(100);
t.rt(90);
}
function Squares()
{
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
Square(); t.rt(30);
}
t.SquareSz = function (sz)
{
this.fd(sz);
this.rt(90);
this.fd(sz);
this.rt(90);
this.fd(sz);
this.rt(90);
this.fd(sz);
this.rt(90);
}
t.SquareSpiral = function()
{
for (var i = 1; i <= 36; i++)
{
this.SquareSz(i * 5); this.rt(10);
}
}
</script>
<div>
<input type="button" value="Square" onclick="Square(); return false;"/>
<input type="button" value="Squares" onclick="Squares(); return false;"/>
<input type="button" value="SquareSpiral" onclick="t.SquareSpiral(); return false;"/>
<input type="button" value="Clear" onclick="t.clear(); return false;"/>
</div
</body>
</html>