-
Notifications
You must be signed in to change notification settings - Fork 78
/
mandelbrot.html
247 lines (220 loc) · 6.58 KB
/
mandelbrot.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>The Mandelbrot Set in HTML5 Canvas & JavaScript</title>
<!--
The Mandelbrot Set, in HTML5 canvas and javascript.
https://github.com/cslarsen/mandelbrot-js
Copyright (C) 2012 Christian Stigen Larsen
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may
obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.
-->
<style type="text/css">
body {
background-color: black;
padding: 0px;
margin: 0px;
font-size: 10pt;
text-shadow: 0px 1px 0px rgb(40, 40, 40);
}
a { color: #ccc; text-decoration: none; }
a:hover { color: #FF3B03; }
#bottom { color: #666; }
#bottom a { color: #666; }
#bottom a:hover { color: #FF3B03; }
#canvasMandelbrot {
background-color: black;
position: absolute;
left: 0px;
top: 0px;
z-index: 0;
padding: 0px;
margin: 0px;
}
#canvasControls {
background-color: transparent;
position: absolute;
left: 0px;
top: 0px;
z-index: 5;
padding: 0px;
margin: 0px;
width:100%;
height:100%;
}
#description {
z-index: 10;
position: absolute;
background-color: rgba(30, 30, 30, 0.6);
font-family: sans-serif;
padding: 20px;
margin: 20px;
border: 2px solid rgba(20, 20, 20, 0.6);
color: #FF3B03;
text-shadow: 0px 1px 0px rgb(40, 40, 40);
width: 300px;
/* Make text non-selecatble */
user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
}
#infoBox:hover {
background-color: rgba(30, 30, 30, 0.3);
color: #444;
border: #222 1px solid;
}
#infoBox {
text-align:right;
z-index: 10;
position: absolute;
right: 5px;
bottom: 5px;
padding: 5px;
background: transparent;
color: rgba(51,51,51,0.1);
text-shadow: none;
font-family: sans-serif;
font-size:8pt;
}
#description table {
color: #ccc;
}
#description input {
color: #ccc;
outline: none;
background-color: rgba(48,48,48,0.3);
border-width: 1px;
border-color: #444;
}
#description select {
border: #444 1px solid;
color: #ccc;
outline: none;
background-color: #333;
-webkit-appearance: none;
font-size: 10pt;
}
#autoIterations {
border: #444 1px solid;
color: #ccc;
outline: none;
background-color: #333;
font-size: 10pt;
}
.headerText {
color: #666;
}
#description .textInput {
text-align: right;
background-color: transparent;
border: #444 1px solid;
font-size: 10pt;
}
hr {
border-color: #222;
}
</style>
</head>
<body onload="focusOnSubmit();">
<div id="description">
<header>
<div style="text-align: center;">
<hr />
<h1>The Mandelbrot Set</h1>
<p class="headerText">In HTML5 Canvas and JavaScript</p>
<hr />
</div>
</header>
<form id="settingsForm" action="javascript:draw(getColorPicker(), getSamples());">
<table>
<tr>
<td>Rendering time</td>
<td>
<span id='renderTime'>0.0</span> seconds</td>
</tr>
<tr>
<td>Speed</td>
<td>
<span id='renderSpeed'>0.00</span> pixels /
<span id='renderSpeedUnit'>second</span>
</td>
</tr>
<tr>
<td>Iterations</td>
<td>
<input class="textInput" size="4" type="text" id="steps" value="50" />
<input type="checkbox" id="autoIterations" checked="checked"/>
<small>auto</small></td>
</tr>
<tr>
<td>Escape radius</td>
<td> <input class="textInput" size="4" type="text"
id="escapeRadius" value="10.0" /> </td>
</tr>
<tr>
<td>Color scheme</td>
<td>
<select id="colorScheme">
<option value="pickColorGrayscale">Grayscale #1</option>
<option value="pickColorHSV1">HSV #1</option>
<option value="pickColorHSV2">HSV #2 Red</option>
<option value="pickColorHSV3">HSV #2 Blue</option>
<option value="pickColorGrayscale2">Grayscale #2</option>
</select>
</td>
</tr>
<tr>
<td>Supersamples</td>
<td><input class="textInput" size="4" type="text" id="superSamples" value="1" /></td>
</tr>
<tr>
<td>Scanline update (ms)</td>
<td><input class="textInput" size="4" type="text"
id="updateTimeout" value="200" /></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" id="submitButton" value="Draw" />
<input type="reset" id="resetButton" value="Reset" />
<input type="button" id="viewPNG" value="View as PNG" />
</td>
</tr>
</table>
</form>
<hr/>
<div id="bottom">
<small>
Made by <a href="https://csl.name">Christian Stigen Larsen</a> —
<a href="https://github.com/cslarsen/mandelbrot-js">Code on Github</a>
<br/> <br/>
Click + drag to zoom in, shift +click to zoom out.
You can change the settings above and hit <i>Draw</i> to render
anew.
</small>
</div>
</div>
<div id="canvasContainer">
<canvas id="canvasMandelbrot" width="0" height="0"> </canvas>
<canvas id="canvasControls" width="0" height="0"> </canvas>
</div>
<div id="infoBox">
<span id="infoText"></span>
</div>
<script type="text/javascript" src="mandelbrot.js">
</script>
</body>
</html>