-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.html
76 lines (67 loc) · 2.83 KB
/
main.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
<html>
<head>
<title>Fractals demo</title>
</head>
<script src="fractals.js">
</script>
<script src="snowflakes.js">
</script>
<script>
var currentSnowflake = new Array();
function submitSegmentResults()
{
sx = parseInt(document.getElementById("startx").value);
sy = parseInt(document.getElementById("starty").value);
angle = parseInt(document.getElementById("anglebox").value);
length = parseInt(document.getElementById("lengthbox").value);
drawSegment(sx,sy,angle,length);
}
function submitFractalCurveResults()
{
sx = parseInt(document.getElementById("curveStartX").value);
sy = parseInt(document.getElementById("curveStartY").value);
segLen = parseInt(document.getElementById("curveSegmentLength").value);
itNum = parseInt(document.getElementById("curveIterationNumber").value);
drawFractalCurve(sx, sy, segLen, itNum);
}
function submitSnowflakeResults()
{
sx = parseInt(document.getElementById("snowflakeStartX").value);
sy = parseInt(document.getElementById("snowflakeStartY").value);
segLen = parseInt(document.getElementById("snowflakeSegmentLength").value);
segCount = parseInt(document.getElementById("snowflakeSegmentCount").value);
drawCircumcircle = document.getElementById("drawCircumcircleBox").checked;
currentSnowflake = [];
currentSnowflake = generateSnowflake(segCount);
drawSnowflake(currentSnowflake, sx, sy, segLen, segCount, drawCircumcircle);
}
</script>
<body onload="drawBackground();">
<p align="center">
Sx: <input type="text" id="startx" size=5 value="400">
Sy: <input type="text" id="starty" size=5 value="300">
Angle: <input type="text" id="anglebox" size=5 value="90">
Length: <input type="text" id="lengthbox" size=5 value="50">
<br>
<input type="button" value="drawSegment" onclick="submitResults();">
<input type="button" value="clearCanvas" onclick="drawBackground();">
<input type="button" value="drawApple" onclick="for (var i=0;i<360;i++) { drawSegment(400,300,i,278);}">
<br>
Sx: <input type="text" id="curveStartX" size=4 value="400">
Sy: <input type="text" id="curveStartY" size=4 value="300">
Segment Length: <input type="text" id="curveSegmentLength" size=4 value="5">
Curve Level: <input type="text" id="curveIterationNumber" size=2 value="4">
<input type="button" value="drawFractalCurve" onclick="submitFractalCurveResults();">
<br>
Sx: <input type="text" id="snowflakeStartX" size=4 value="512">
Sy: <input type="text" id="snowflakeStartY" size=4 value="384">
Segment Length: <input type="text" id="snowflakeSegmentLength" size=4 value="1">
Segment Count: <input type="text" id="snowflakeSegmentCount" size=4 value="15000">
<input type="checkbox" id="drawCircumcircleBox"> Draw circumcircle
<input type="button" value="generateSnowflake" onclick="submitSnowflakeResults();">
<br>
<canvas id="mainCanvas" width=1024 height=768
</canvas>
</p>
</body>
</html>