-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
440 lines (385 loc) · 18 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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Line Art</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Line Art" />
<meta property="og:type" content="website" />
<meta property="og:description" content="Relax, play around, and find your eye candy." />
<meta property="og:url" content="http://ericyd.com/line-art" />
<meta property="og:image" content="https://raw.githubusercontent.com/ericyd/line-art/master/images/sample.png" />
<meta property="og:image:width" content="334" />
<meta property="og:image:height" content="199" />
<meta property="og:image:alt" content="Sample not available, so make your own!" />
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- SVG definitions -->
<svg class="sr-only">
<defs>
<path id="svg-close-button" d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"
/>
<path id="svg-hamburger-button" d="M24 6h-24v-4h24v4zm0 4h-24v4h24v-4zm0 8h-24v4h24v-4z" />
<path fill-rule="evenodd" clip-rule="evenodd" fill="currentColor" id="svg-animation-direction-toggle" d="M12 0c6.623 0 12 5.377 12 12s-5.377 12-12 12-12-5.377-12-12 5.377-12 12-12zm0 2c5.519 0 10 4.481 10 10s-4.481 10-10 10-10-4.481-10-10 4.481-10 10-10zm2 12v-3l5 4-5 4v-3h-9v-2h9zm-4-6v-3l-5 4 5 4v-3h9v-2h-9z"
/>
<path id="triangle" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="10" d="M0 10 L40 50 L0 90 L0 10"></path>
</defs>
</svg>
<section id="sidebar" class="sidebar collapsed">
<div class="sidebar__header">
Click an image to edit
<button id="close-sidebar" class="btn--secondary btn--menu">
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
<use href="#svg-close-button" />
</svg>
</button>
<button id="refresh" class="btn">Get new samples</button>
</div>
<div class="sidebar__thumbnails">
<canvas class="sidebar__thumb" id="myCanvas0" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas1" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas2" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas3" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas4" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas5" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas6" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas7" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas8" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas9" width="225" height="225"></canvas>
<canvas class="sidebar__thumb" id="myCanvas10" width="225" height="225"></canvas>
</div>
</section>
<section class="main push-body">
<div id="mainCanvasControls" class="main__controls hide">
<fieldset class="control-group">
<button id="open-sidebar" class="btn--secondary btn--menu">
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
<use href="#svg-hamburger-button" />
</svg>
Generated images
</button>
</fieldset>
<fieldset class="control-group is-expanded">
<legend class="control-group__legend toggler">
Style
</legend>
<!-- line color, bgColor, solid -->
<div class="toggle-target">
<div class="row">
<fieldset class="main__radios">
<legend class="control__label control__label--block">
line color
<span id="lineColor-value" class="control__value hide"></span>
</legend>
<div class="main__radios">
<input type="radio" name="lineColor" id="colorful" class="control__input--radio" />
<label class="control__label--radio" for="colorful">colorful</label>
<input type="radio" name="lineColor" id="white" class="control__input--radio" />
<label class="control__label--radio" for="white">white</label>
<input type="radio" name="lineColor" id="black" class="control__input--radio" />
<label class="control__label--radio" for="black">black</label>
</div>
</fieldset>
</div>
<div class="row">
<label for="bgColor" class="control__label control__label--block">background color:
<span id="bgColor-value" class="control__value"></span>
</label>
<input type="color" id="bgColor" class="control__input">
</div>
<div class="row">
<label for="solid" class="control__label row__item">
solid
<span id="solid-value" class="control__value hide"></span>
</label>
<div class="row__item">
<input type="checkbox" id="solid">
</div>
</div>
</div>
</fieldset>
<fieldset class="control-group is-expanded">
<legend class="control-group__legend toggler">
X modulator
</legend>
<div class="toggle-target">
<label for="xModDepth" class="control__label">
depth:
<span id="xModDepth-value" class="control__value"></span>
</label>
<input type="range" id="xModDepth" class="control__input--range">
<!-- animation -->
<div id="xModDepth-animate" class="animation-group">
<div class="row">
<label for="xModDepth-animation-run-toggle" class="control__label row__item">
animate
</label>
<div class="row__item">
<input type="checkbox" id="xModDepth-animation-run-toggle" class="control__input animation-run-toggle">
</div>
</div>
<div class="row">
<div class="row__item">
flip direction
</div>
<div class="row__item">
<button type="button" class="animation-direction-toggle" title="flip direction">
<svg width="1em" height="1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<use href="#svg-animation-direction-toggle" />
</svg>
</button>
</div>
</div>
<div class="row">
<label for="xModDepth-animation-speed" class="control__label row__item">speed</label>
<input type="range" id="xModDepth-animation-speed" class="control__input--70 animation-step row__item">
</div>
</div>
<div class="row row--margin-top">
<!-- value attributes and data-display attributes are
set programmatically in the init() function -->
<fieldset class="main__radios">
<legend class="control__label control__label--block">
modulator function
<span id="oscillatorX-value" class="control__value hide"></span>
</legend>
<div class="main__radios">
<input type="radio" name="oscillatorX" id="osc0" class="control__input--radio" />
<label class="control__label--radio" for="osc0">1</label>
<input type="radio" name="oscillatorX" id="osc1" class="control__input--radio" />
<label class="control__label--radio" for="osc1">2</label>
<input type="radio" name="oscillatorX" id="osc2" class="control__input--radio" />
<label class="control__label--radio" for="osc2">3</label>
<input type="radio" name="oscillatorX" id="osc3" class="control__input--radio" />
<label class="control__label--radio" for="osc3">4</label>
<input type="radio" name="oscillatorX" id="osc4" class="control__input--radio" />
<label class="control__label--radio" for="osc4">5</label>
<input type="radio" name="oscillatorX" id="osc5" class="control__input--radio" />
<label class="control__label--radio" for="osc5">6</label>
<input type="radio" name="oscillatorX" id="osc6" class="control__input--radio" />
<label class="control__label--radio" for="osc6">7</label>
<input type="radio" name="oscillatorX" id="osc7" class="control__input--radio" />
<label class="control__label--radio" for="osc7">8</label>
<input type="radio" name="oscillatorX" id="osc8" class="control__input--radio" />
<label class="control__label--radio" for="osc8">9</label>
</div>
</fieldset>
</div>
</div>
</fieldset>
<fieldset class="control-group is-expanded">
<legend class="control-group__legend toggler">
Y Modulator
</legend>
<div class="toggle-target">
<label for="yModDepth" class="control__label">
depth:
<span id="yModDepth-value" class="control__value"></span>
</label>
<input type="range" id="yModDepth" class="control__input--range">
<!-- animation -->
<div id="yModDepth-animate" class="animation-group">
<div class="row">
<label for="yModDepth-animation-run-toggle" class="control__label row__item">
animate
</label>
<div class="row__item">
<input type="checkbox" id="yModDepth-animation-run-toggle" class="control__input animation-run-toggle">
</div>
</div>
<div class="row">
<div class="row__item">
flip direction
</div>
<div class="row__item">
<button type="button" class="animation-direction-toggle" title="flip direction">
<svg width="1em" height="1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<use href="#svg-animation-direction-toggle" />
</svg>
</button>
</div>
</div>
<div class="row">
<label for="yModDepth-animation-speed" class="control__label row__item">speed</label>
<input type="range" id="yModDepth-animation-speed" class="control__input--70 animation-step row__item">
</div>
</div>
<div class="row row--margin-top">
<!-- value attributes and data-display attributes are
set programmatically in the init() function -->
<fieldset class="main__radios">
<legend class="control__label control__label--block">
modulator function
<span id="oscillatorY-value" class="control__value hide"></span>
</legend>
<div class="main__radios">
<input type="radio" name="oscillatorY" id="osc10" class="control__input--radio" />
<label class="control__label--radio" for="osc10">1</label>
<input type="radio" name="oscillatorY" id="osc11" class="control__input--radio" />
<label class="control__label--radio" for="osc11">2</label>
<input type="radio" name="oscillatorY" id="osc12" class="control__input--radio" />
<label class="control__label--radio" for="osc12">3</label>
<input type="radio" name="oscillatorY" id="osc13" class="control__input--radio" />
<label class="control__label--radio" for="osc13">4</label>
<input type="radio" name="oscillatorY" id="osc14" class="control__input--radio" />
<label class="control__label--radio" for="osc14">5</label>
<input type="radio" name="oscillatorY" id="osc15" class="control__input--radio" />
<label class="control__label--radio" for="osc15">6</label>
<input type="radio" name="oscillatorY" id="osc16" class="control__input--radio" />
<label class="control__label--radio" for="osc16">7</label>
<input type="radio" name="oscillatorY" id="osc17" class="control__input--radio" />
<label class="control__label--radio" for="osc17">8</label>
<input type="radio" name="oscillatorY" id="osc18" class="control__input--radio" />
<label class="control__label--radio" for="osc18">9</label>
</div>
</fieldset>
</div>
</div>
</fieldset>
<fieldset class="control-group is-expanded">
<legend class="control-group__legend toggler">
Length
</legend>
<div class="toggle-target">
<label for="len" class="control__label">
length:
<span id="len-value" class="control__value"></span>
</label>
<input type="range" id="len" class="control__input--range">
<!-- animation -->
<div id="len-animate" class="animation-group">
<div class="row">
<label for="len-animation-run-toggle" class="control__label row__item">
animate
</label>
<div class="row__item">
<input type="checkbox" id="len-animation-run-toggle" class="control__input animation-run-toggle">
</div>
</div>
<div class="row">
<div class="row__item">
flip direction
</div>
<div class="row__item">
<button type="button" class="animation-direction-toggle" title="flip direction">
<svg width="1em" height="1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<use href="#svg-animation-direction-toggle" />
</svg>
</button>
</div>
</div>
<div class="row">
<label for="len-animation-speed" class="control__label row__item">speed</label>
<input type="range" id="len-animation-speed" class="control__input--70 animation-step row__item">
</div>
</div>
</div>
</fieldset>
<fieldset class="control-group is-expanded">
<legend class="control-group__legend toggler">
Line Width
</legend>
<div class="toggle-target">
<label for="width" class="control__label">
line width:
<span id="width-value" class="control__value"></span>
</label>
<input type="range" id="width" class="control__input--range">
<!-- animation -->
<div id="width-animate" class="animation-group">
<div class="row">
<label for="width-animation-run-toggle" class="control__label row__item">
animate
</label>
<div class="row__item">
<input type="checkbox" id="width-animation-run-toggle" class="control__input animation-run-toggle">
</div>
</div>
<div class="row">
<div class="row__item">
flip direction
</div>
<div class="row__item">
<button type="button" class="animation-direction-toggle" title="flip direction">
<svg width="1em" height="1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<use href="#svg-animation-direction-toggle" />
</svg>
</button>
</div>
</div>
<div class="row">
<label for="width-animation-speed" class="control__label row__item">speed</label>
<input type="range" id="width-animation-speed" class="control__input--70 animation-step row__item">
</div>
</div>
</div>
</fieldset>
<fieldset class="control-group is-expanded">
<legend class="control-group__legend toggler">
Resolution
</legend>
<div class="toggle-target">
<label for="resolution" class="control__label">
resolution:
<span id="resolution-value" class="control__value"></span>
</label>
<input type="range" id="resolution" class="control__input--range">
<!-- animation -->
<div id="resolution-animate" class="animation-group">
<div class="row">
<label for="resolution-animation-run-toggle" class="control__label row__item">
animate
</label>
<div class="row__item">
<input type="checkbox" id="resolution-animation-run-toggle" class="control__input animation-run-toggle">
</div>
</div>
<div class="row">
<div class="row__item">
flip direction
</div>
<div class="row__item">
<button type="button" class="animation-direction-toggle" title="flip direction">
<svg width="1em" height="1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<use href="#svg-animation-direction-toggle" />
</svg>
</button>
</div>
</div>
<div class="row">
<label for="resolution-animation-speed" class="control__label row__item">speed</label>
<input type="range" id="resolution-animation-speed" class="control__input--70 animation-step row__item">
</div>
</div>
</div>
</fieldset>
<fieldset class="control-group">
<button id="shareBtn" class="btn">Share!</button>
<br />
<a href="#" id="downloadBtn" class="btn" download="image.png">Download</a>
<br />
<a href="#" id="downloadBtnHiRes" class="btn" download="image.png">Download Hi Res</a>
<div>
A few notes:
<ul>
<li>To fine-tune a slider, click it and then use the arrow keys</li>
<li>If things are running slowly, try turning down the resolution</li>
<li>When downloading Hi Res, you might want to increase line width as it doesn't naturally scale with the image size</li>
</ul>
</div>
</fieldset>
</div>
<canvas id="mainCanvas" width="800" height="800"></canvas>
<canvas id="downloadCanvas" class="sr-only" width="2000" height="2000"></canvas>
</section>
<script src="app.js"></script>
</body>
<!--
Credits:
https://iconmonstr.com/connection-8-svg/
https://iconmonstr.com/menu-1-svg/
https://iconmonstr.com/x-mark-1-svg/
-->
</html>