-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
293 lines (269 loc) · 14.6 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
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="procedural art, procedural generation, function quantizer">
<meta name="description" content="An easy-to-use tool for anyone, interested in procedural
generation and function quantizing.">
<meta name="author" content="Roman Dobias">
<meta property="og:title" content="QTA - QuantizeThemAll" />
<meta property="og:type" content="website" />
<title>QTA - QuantizeThemAll</title>
<link rel="stylesheet" href="css/mini-default.css" />
<link rel="stylesheet" href="css/app.css" />
<script type="text/javascript" src="js/three.min.js"></script>
<script type="text/javascript" src="js/renderer.js"></script>
<script type="text/javascript" src="js/generator.js"></script>
<link rel="icon" href="docs/logo.png" type="image/png" sizes="16x16">
</head>
<body>
<div id="previewGrid" class="container hidden">
<div>
<button class="secondary" onclick="document.getElementById('previewGrid').classList.toggle('hidden');">Close </button>
<button class="secondary" id="gridRedoButton" >Redo
operation</button>
</div>
<div id="previewElements"></div>
</div>
<div class="container hidden-lg">
<div class="row">
<div class="col-sm-12 col-md-6">
<h1>QuantizeThemAll <img src="docs/logo.png" width="64px"></h1>
</div>
<div class="col-sm-12 col-md-6" style="text-align: right;">
<button class="small" type="button" onclick="input_shareURL();">
<span class="tooltip bottom" aria-label="Share this function and its parameters with friends!">
<span class="icon-link"></span> Share</span></button>
<a href="https://github.com/Romop5/QuantitizeThemAll"><button class="small"><img src="docs/github.png" width="12px">
GitHub</button></a>
<button class="small inverse" onclick="experimental_toggleExperimental()"><span
class="icon-help big inverse"></span>
Experimental</button>
<a href="docs/about.html"><button class="small"><span class="icon-help big"></span>
</button></a>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6" id='canvas-parent'>
<div id='canv'>
</div>
<div id="init-error" class="hidden">
<div class="card error">
Failed to initialize application!
</div>
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="container hidden-md hidden-sm">
<div class="row">
<div class="col-sm-12 col-md-6">
<h1>QuantizeThemAll <img src="docs/logo.png" width="64px"></h1>
</div>
<div class="col-sm-12 col-md-6" style="text-align: right;">
<button class="small" type="button" onclick="input_shareURL();">
<span class="tooltip bottom" aria-label="Share this function and its parameters with friends!">
<span class="icon-link"></span> Share
</span>
</button>
<a href="docs/about.html"><button class="small"><span class="icon-help big"></span>
</button></a>
<a href="https://github.com/Romop5/QuantitizeThemAll"><button class="small"><img src="docs/github.png" width="12px">
</button></a>
<button class="small inverse" onclick="experimental_toggleExperimental()"> <span class="icon-alert big inverse "></span>
Experimental</button>
</div>
</div>
</div>
<form>
<fieldset>
<legend>Function</legend>
<div class="container">
<div class="row">
<div class="col-sm-12">
<input style="width: 100%;" type="text" id="inputProgram" value="x*x+y*y" oninput="input_updateProgram();"/>
<button class="primary" type="button" onclick="input_generateFunction();">Generate!</button>
<button class="secondary" type="button"
onclick="input_mutateFunction();">
<span class="tooltip" aria-label="Mutate all numerical constants (Key: M)">Mutate!</span></button>
</button>
<button class="secondary" type="button"
onclick="input_mutateStructure();">
<span class="tooltip" aria-label="Mutate structure (via generation)(Key:
M)">Mutate structure!</span></button>
</button>
<button class="primary" type="button" onclick="experimental_mutateGrid();">#
Const</button>
<button class="primary" type="button"
onclick="experimental_mutateGridStructure();"># Struct</button>
<button class="secondary" type="button"
onclick="input_historyStep(false);">
<span class="tooltip" aria-label="Undo (Key: U)">↺</span></button>
<button class="secondary" type="button"
onclick="input_historyStep(true);">
<span class="tooltip" aria-label="Redo (Key: R)">↻</span></button>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<legend>Generator settings</legend>
<label for="minIters">Min. iterations:</label>
<input type="number" size="3" value="5" min="1" max="40" id="minIters" onchange="input_updateGeneratorRules();">
<label for="maxIters">Max. iterations:</label>
<input type="number" size="3" value="1" min="1" max="40" id="maxIters" onchange="input_updateGeneratorRules();">
<label for="oscillation">Randomizer oscillations:</label>
<input type="number" size="5" value="1" min="1" max="10000" id="oscillation" onchange="input_updateGeneratorRules();">
<br>
<input type="checkbox" id="allow_modulo" value="Allow modulo" onchange="input_updateGeneratorRules();">
<label for="allow_modulo">mod</label>
<input type="checkbox" id="allow_sin" onchange="input_updateGeneratorRules();">
<label for="allow_sin">sin,cos</label>
<input type="checkbox" id="allow_tan" onchange="input_updateGeneratorRules();">
<label for="allow_tan">tan</label>
<input type="checkbox" id="allow_minmax" onchange="input_updateGeneratorRules();">
<label for="allow_minmax">min max</label>
<input type="checkbox" id="allow_abs" onchange="input_updateGeneratorRules();">
<label for="allow_abs">abs</label>
<input type="checkbox" id="allow_inv" onchange="input_updateGeneratorRules();">
<label for="allow_inv">inv</label>
<input type="checkbox" id="allow_pow" onchange="input_updateGeneratorRules();">
<label for="allow_pow">pow</label>
<input type="checkbox" id="allow_constant" onchange="input_updateGeneratorRules();">
<label for="allow_constant">random constants</label>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-4">
<legend><span class="tooltip" aria-label="Choose how input UVs is
transformed before passing to function">Transformations</span></legend>
<select name="transforms" id="inputTransformation"
onchange="input_updateTransformation()">
<option value="linear">Identity</option>
<option value="polar">Polar</option>
<option value="circle">Circle inversion</option>
<option value="spherical">Spherical (f = 1)</option>
<option value="fisheye">Fisheye</option>
</select>
</div>
<div class="col-sm-12 col-md-4">
<legend>Zoom</legend>
<input type="range" step="0.1" min="0.1" max="5" value="1.0" class="slider"
id="inputZoom" oninput="input_updateTransformation()">
</div>
<div class="col-sm-12 col-md-4">
<legend>Focal length</legend>
<input type="range" step="0.1" min="0.1" max="5" value="1.0" class="slider"
id="inputFocal" oninput="input_updateTransformation()">
</div>
<div class="col-sm-12 col-md-4">
<legend>Offset (X,Y)</legend>
<input type="text" id="offsetX" size="4" value="0.0" step="0.1"
oninput="input_updateTransformation()"/>
<input type="text" id="offsetY" size="4" value="0.0" step="0.1"
oninput="input_updateTransformation()"/>
<button class="secondary small" type="button"
onclick="input_resetTranslation();">🗑</button>
</div>
<div class="col-sm-12 col-md-4">
<legend>Coloring</legend>
<input type="color" id="startColor" value="#ff0000" oninput="input_updateColor()" />
<button class="primary small" type="button" onclick="input_invertColor();">⇆</button>
<input type="color" id="endColor" value="#00ff00" oninput="input_updateColor()"/>
</div>
<div class="col-sm-12 col-md-8">
<legend>Thresholding</legend>
<select name="thresholdingMenu" id="inputThresholding"
onchange="input_updateColor()">
<option value="none">None</option>
<option value="color">Color</option>
<option value="contour">Contour</option>
</select>
<label for="inputThreshold">Threshold position</label>
<input type="range" step="0.01" min="0" max="1.0" value="0.5" class="slider"
id="inputThreshold" oninput="input_updateColor()">
</div>
</div>
</div>
</fieldset>
<fieldset id="experimental-menu" class="hidden">
<legend>Experimental</legend>
<button id="experimental-play" class="primary" type="button"
onclick="experimental_input_toggleTime();">⏯</button>
<button class="primary" type="button" onclick="experimental_input_resetTime();">⏮</button>
<label for="experimentalSpeed">Speed: </label>
<input type="number" id="experimentalSpeed" size="4" value="1.0" oninput="experimental_updateSpeed()"/>
<button class="primary" type="button"
onclick="experimental_mutateTime();">Mutate time</button>
<button class="primary" type="button"
onclick="experimental_freezeTime();">Freeze time</button>
<button class="primary" type="button" onclick="experimental_exportShaderToy();">Export
to ShaderToy</button>
</fieldset>
<fieldset>
<legend>Presets</legend>
<select name="presets" id="inputPreset" placeholder="Saved preset"
onchange="input_setPreset()">
<!--<option value="scorpion">Scorpion</option>-->
<!--<option value="lol">lol</option>-->
</select>
<input type="text" id="inputPresetName" placeholder="New preset name"/>
<button class="primary" type="button" onclick="input_savePreset();">Add!</button>
<button class="primary" type="button" onclick="input_exportPresets();">
<span class="tooltip" aria-label="Generate JSON file with presets">Export all presets
</span></button>
<br>
<label for="importFile">Import presets from text file:</label>
<input type="file" id="importFile" oninput="input_importPresets();" text="Import!">
</fieldset>
<fieldset>
<legend>Output image settings</legend>
<label for="outputWidth">Width</label>
<input type="number" id="outputWidth" value="2048" size=10/>
<label for="outputHeight">Height</label>
<input type="number" id="outputHeight" value="2048"/ size=10>
<button class="primary" type="button" onclick="saveAsImage();">⭳ Save as PNG!</button>
</fieldset>
</form>
<div class="col-lg-12">
<center>
Spread love with
<a class="github-button"
href="https://github.com/Romop5/QuantitizeThemAll" data-size="large"
data-show-count="true" aria-label="Star Romop5/QuantitizeThemAll on
GitHub">Star</a>
</center>
</div>
</div>
</div>
</div>
<!-- Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
<script type="text/javascript">
function isWebGLAvailable() {
try {
var canvas = document.createElement( 'canvas' );
return !! ( window.WebGLRenderingContext && ( canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) ) );
} catch ( e ) {
return false;
}
}
window.onload = function(){
try {
if ( isWebGLAvailable() ) {
init();
} else {
throw "WebGL not available!"
}
} catch(err)
{
document.getElementById("init-error").classList.remove("hidden")
document.getElementById("canv").classList.add("hidden")
}
animate();
input_updateProgram();
}
</script>
</body>
</html>