-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
101 lines (82 loc) · 2.15 KB
/
index.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html>
<head>
<title>Javascript Turtle</title>
<script type='text/javascript' src='jquery-1.6.4.min.js'></script>
<script src='ace-builds/src-min-noconflict/ace.js' type='text/javascript' charset='utf-8'></script>
<link type='text/css' rel='stylesheet' href='turtle.css' />
</head>
<!-- ...................................................................... -->
<body>
<h1>
Javascript Turtle Graphics
<img src='turtle.png' height='75px' style='vertical-align: bottom'>
</h1>
<div id='canvas'>
<canvas id='turtlecanvas'></canvas>
<canvas id='imagecanvas' style='display:none'></canvas>
</div>
<div id='code'>
<div id='language-reference'>// language reference
forward(distance);
right(angle);
left(angle);
goto(x,y);
clear();
penup();
pendown();
reset();
angle(angle);
width(width);
color(r,g,b,a);
write(string);
n = random(low,high);
hideTurtle();
showTurtle();
redrawOnMove(bool);
draw();
repeat(n, action);
wrap(bool);
animate(action,ms);
// (Windows) (OS X)
// run: Ctrl+Enter Cmd+Enter
// reset: Ctrl+Esc Cmd+Esc
</div>
<div id='editor'>// Write commands here. For example:
function square(side) {
repeat(4, function () {
forward(side);
right(90);
});
}
function demo() {
hideTurtle();
color(0,0,255,1);
for(s = 100; s > 0; s -= 10) {
square(s);
right(36);
}
}
reset();
demo();
</div>
</div>
<button onclick='reset();'>Reset</button>
<button onclick='executeCommands();'>Run Commands</button>
<button onclick='downloadImage();'>Download Image</button>
<p>
width: <input type='text' id='input-width' onchange='setXPixels();'>
height: <input type='text' id='input-height' onchange='setYPixels();'>
</p>
<button onclick='downloadRender();'>Download Render</button>
<p>
render scale: <input type='text' id='input-render-scale' onchange='setRenderScale();'>
</p>
<hr>
<div id='footer'>
Modified from a <a href='http://berniepope.id.au/html/js-turtle/turtle.html'>page by Bernie Pope</a><br>
Turtle graphic from <a href='http://www.mycutegraphics.com/graphics/turtle/cute-turtle.html'>MyCuteGraphics</a>
</div>
<script type='text/javascript' src='turtle.js'></script>
</body>
</html>