-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
97 lines (95 loc) · 3.77 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
<!doctype html> <html>
<head> <title> Julia Set Viewer </title>
<style>
.desc {
float: right;
width: 300px;
}
#juliaDraw {
border: 1px dotted;
float: left;
}
.canvasWrapper canvas {
position: absolute;
top: 0;
left: 0;
}
</style > </head>
<body>
<div class="desc">
<h1>Julia Set Viewer</h1> <p> You can view Julia sets with this simple online tool.Don 't know what a Julia set is? Learn about it <a href="https://www.youtube.com/watch?v=2AZYZ-L8m9Q">here.</a>
This script uses a complex number library that I built to handle the arithmetic required to process these images. The source code is hosted on my <a href="https://github.com/jamjar919">github.</a>
Numbers between -1 and 1 make the best images.
</p>
<form>
<label>Real:
<input type="text" id="realValue" value="0">
</label> <br>
<label>Imag:
<input type="text" id="imagValue" value="0">
</label>
<script>
function randomFractal() {
document.getElementById("realValue").value = Math.random()*2 -1;
document.getElementById("imagValue").value = Math.random()*2 -1;
}
randomFractal();
function resetDefaultAdvancedOptions() {
document.getElementById("range").value = "4";
document.getElementById("startposreal").value = "-2";
document.getElementById("startposimag").value = "2";
document.getElementById("maxiteration").value = "2500"
document.getElementById("boundary").value = "4";
}
function toggleAdvancedDisplay() {
var container = document.getElementById("advancedOptions");
if (container.style.display == "none") {
container.style.display = "block"
} else {
container.style.display = "none"
}
}
</script>
<br>
<label>Draw convergence paths:<input type="checkbox" id="drawLines" onClick="handleConvergence()"></label><br>
<label> Iteration equation; <br>
<input type="radio" name="iterEq" value="1" checked> z^2 + c<br>
<input type="radio" name="iterEq" value="2"> z^3 + c<br>
<input type="radio" name="iterEq" value="3"> z^2 + cz + c <br>
<input type="radio" name="iterEq" value="4"> (|real(z)| + i*|imag(z)|)^2 + c (Burning Ship) <br>
<input type="radio" name="iterEq" value="5"> e^z + c <br>
</label>
<input type="button" onClick="drawJulia()" value="Draw">
<input type="button" onClick="randomFractal(); drawJulia();" value="Random">
</form>
<br>
<p id="status" style="color: grey;">Idle</p>
<p>Drawn from <span id="fromNum"></span> to <span id="toNum"></span></p>
<p>Current mouse pos: <span id="xyPos"></span></p>
<p>Current mouse x,y: <span id="xyCoords"></span></p>
<div id="selectionInfo" style="display:none;">
<p>Selected from</p>
<p id="fromSelection"></p>
<p>to</p>
<p id="toSelection"></p>
</div>
<input type="button" onClick="toggleAdvancedDisplay();" value="Advanced">
<div id="advancedOptions" style="display:none">
<p>Advanced options are applied when you draw a new fractal.</p>
<label>Apply advanced options:<input type="checkbox" id="applyAdvanced"></label><br>
<label>RANGE:<input type="text" value="4" id="range"></label>
<label>STARTPOSREAL:<input type="text" value="-2" id="startposreal"></label>
<label>STARTPOSIMAG:<input type="text" value="2" id="startposimag"></label>
<label>MAXITERATION<input type="text" value="2500" id="maxiteration"></label>
<label>BOUNDARY<input type="text" value="4" id="boundary"></label>
<input type="button" value="Reset Defaults" onClick="resetDefaultAdvancedOptions();">
</div>
</div>
<div class="canvasWrapper">
<canvas id="juliaDraw" width=750 height=750 onClick="drawZoomJulia()"></canvas>
<canvas id="overlay" width=750 height=750 oncontextmenu="return false;"></canvas>
</div>
<script src="complex.js"></script>
<script src="juliaset.js"></script>
</body>
</html>