-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolyrhythm-gen.html
220 lines (191 loc) · 14.8 KB
/
polyrhythm-gen.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Polyrhythm Generator</title>
<link id="default-style" rel="stylesheet" href="default.css">
<link id="polyrhythm-gen-style" rel="stylesheet" href="polyrhythm-gen-style.css">
<script src="polyrhythm-gen-script.js" await></script>
</head>
<body onload="ready()">
<div class="top-container">
<canvas id="Polyrhythm-Canvas" class="generated-area" width="750px" height="750px">Canvas did not load</canvas>
<div class="parameters" id="parameters">
<h1>Parameters</h1>
<p>Note: click on screen to play audio.</p>
<div id="parameter-container" class="parameter-container">
<div class="input-wrapper">
<button type="button" onclick="updateJsonData()">Update</button>
<button type="button" onclick="showJsonData()">JSON Data</button>
<button type="button" onclick="showEmbedData()">Embed</button>
<button type="button" onclick="showLink()">Share Link</button>
<div id="use-json">
<h3>Use JSON data:</h3>
<input id="add-json-data" value="Paste JSON here" type="text">
<button type="button" onclick="useJsonData()">Use JSON</button>
</div>
<div id="json-container" class="shown-by-button-container">
<h3 style="margin: 0;">JSON data:</h3>
<textarea class="json-data" id="json-data"></textarea>
</div>
<div id="embed-container" class="shown-by-button-container">
<h3 style="margin: 0;">Embed data:</h3>
<textarea class="embed-data" id="embed-data"></textarea>
</div>
<div id="share-container" class="shown-by-button-container">
<h3 style="margin: 0;">Share link:</h3>
<textarea class="share-data" id="share-data"></textarea>
</div>
</div>
<div class="input-wrapper">
<h2>Colors</h2>
<div class="input-field-list field-list">
<label for="circle_color">Circle Color:</label><input name="circle_color" id="circle_color" data="circle_color" type="text">
<label for="line_color">Line Color:</label><input name="line_color" id="line_color" data="line_color" type="text">
<label for="background_color">Background Color:</label><input name="background_color" id="background_color" data="background_color" type="text">
</div>
<label for="line-color-by-index-checkbox">Line Color by Index:</label><input name="line-color-by-index-checkbox" id="line-color-by-index-checkbox" data="line_color_by_index_enabled" type="checkbox">
<button type="button" style="margin-top: 1em;" onclick="updateCountOfFields('line-color-by-index-container', 'line-color-input', 'line_color_by_index color', '#aaaaaa')">Update Amount</button>
<p>Line Color by Index (if enabled and update amount button pressed):</p>
<div id="line-color-by-index-container">
</div>
<label for="circle-color-by-index-checkbox">Circle Color by Index:</label><input name="circle-color-by-index-checkbox" id="circle-color-by-index-checkbox" data="circle_color_by_index_enabled" type="checkbox">
<button type="button" style="margin-top: 1em;" onclick="updateCountOfFields('circle-color-by-index-container', 'circle-color-input', 'circle_color_by_index color', '#ffffff')">Update Amount</button>
<p>Circle Color by Index (if enabled and update amount button pressed):</p>
<div id="circle-color-by-index-container">
</div>
</div>
<div class="input-wrapper">
<h2>Animation</h2>
<div class="input-field-list field-list">
<label for="count">Line Count:</label><input name="count" id="count" data="count" type="text">
<label for="animation_length">Animation Length (sec):</label><input name="animation_length" id="animation_length" data="animation_length" type="text">
<label for="cycle_count">Cycle Count:</label><input name="cycle_count" id="cycle_count" data="completed_cycle_count" type="text">
<label for="completed_cycle_count_by_index">Cycles * Index:</label><input name="completed_cycle_count_by_index" id="completed_cycle_count_by_index" data="completed_cycle_count_by_index" type="text">
<label for="fill_mode">Fill Mode:</label>
<select name="fill_mode" id="fill_mode" data="fill_mode">
<option value="forwards">Forwards</option>
<option value="backwards">Backwards</option>
<option value="both">Both</option>
</select>
<label for="width">Width:</label><input name="width" id="width" data="width" type="text">
<label for="height">Height:</label><input name="height" id="height" data="height" type="text">
</div>
</div>
<div class="input-wrapper">
<h2>Precentage For Sound</h2>
<p>Make the sound play multiple times in the animation.</p>
<div class="input-field-list field-list">
<label for="precentage-enable-checkbox">Enable Precentage</label><input name="precentage-enable-checkbox" id="precentage-enable-checkbox" data="precentage_enabled" type="checkbox">
</div>
<button type="button" style="margin-top: 1em;" onclick="updateCountOfFields('precentage-amount-container', 'precentage-input', 'precentage_amount amount', '1')">Update Amount</button>
<p>Precentage Amount [0-1]:</p>
<div id="precentage-amount-container" class="input-field-list field-list">
</div>
</div>
<div class="input-wrapper">
<h2>Audio</h2>
<div class="input-field-list field-list">
<label for="pitch_difference">Pitch Change * Index:</label><input name="pitch_difference" id="pitch_difference" data="pitch_difference" type="text">
</div>
<p>Choose pitch for each line</p>
<p>Value of 1 is a half step above middle C, value of 12 is an Octave. Can be a negative.</p>
<div class="input-field-list field-list">
<label for="pitch-enable-checkbox">Enable Pitch Change by index</label><input name="pitch-enable-checkbox" id="pitch-enable-checkbox" data="pitch_by_index_enabled" type="checkbox">
</div>
<button type="button" style="margin-top: 1em;" onclick="updateCountOfFields('pitch-by-index-container', 'pitch-by-index', 'pitch_by_index pitch', '1')">Update Amount</button>
<p>Pitch Difference</p>
<div id="pitch-by-index-container" class="input-field-list field-list">
</div>
</div>
<div class="input-wrapper">
<div class="type-selector">
<h2 class="bezier-selector selected" onclick="selectBezier()">Bezier Curve</h2>
<h2>-</h2>
<h2 class="svg-selector" onclick="selectSVG()">SVG</h2>
</div>
<div class="input-field-list bezier-type">
<p>Point 1 (Start)</p>
<div class="point-input">
<label for="p1x">X:</label><input name="p1x" id="p1x" data="bezier_curve p1 x" type="text">
<label for="p1y">Y:</label><input name="p1y" id="p1y" data="bezier_curve p1 y" type="text">
</div>
<p>Point 2 (End)</p>
<div class="point-input">
<label for="p2x">X:</label><input name="p2x" id="p2x" data="bezier_curve p2 x" type="text">
<label for="p2y">Y:</label><input name="p2y" id="p2y" data="bezier_curve p2 y" type="text">
</div>
<p>Control Point 1</p>
<div class="point-input">
<label for="cp1x">X:</label><input name="cp1x" id="cp1x" data="bezier_curve cp1 x" type="text">
<label for="cp1y">Y:</label><input name="cp1y" id="cp1y" data="bezier_curve cp1 y" type="text">
</div>
<p>Control Point 2</p>
<div class="point-input">
<label for="cp2x">X:</label><input name="cp2x" id="cp2x" data="bezier_curve cp2 x" type="text">
<label for="cp2y">Y:</label><input name="cp2y" id="cp2y" data="bezier_curve cp2 y" type="text">
</div>
</div>
<div id="svg-type" class="input-field-list svg-type hidden">
<p>SVG List</p>
<p>The "Update Amount" button changes how many lines for SVG input, based on the "Line Count" section</p>
<p>Learn more about SVGs <a href="https://en.wikipedia.org/wiki/SVG">here</a></p>
<button type="button" onclick="updateCountOfFields('svg-type', 'svg-input', 'svg_paths path', 'M10 10 h 80 v 80 h -80 Z')">Update Amount</button>
</div>
</div>
<div class="input-wrapper bezier-type">
<h2>Points Offset * Index</h2>
<div class="input-field-list">
<p>Point 1 (Start)</p>
<div class="point-input">
<label for="p1x-offset">X:</label><input name="p1x-offset" id="p1x-offset" data="offset_by_index p1 x" type="text">
<label for="p1y-offset">Y:</label><input name="p1y-offset" id="p1y-offset" data="offset_by_index p1 y" type="text">
</div>
<p>Point 2 (End)</p>
<div class="point-input">
<label for="p2x-offset">X:</label><input name="p2x-offset" id="p2x-offset" data="offset_by_index p2 x" type="text">
<label for="p2y-offset">Y:</label><input name="p2y-offset" id="p2y-offset" data="offset_by_index p2 y" type="text">
</div>
<p>Control Point 1</p>
<div class="point-input">
<label for="cp1x-offset">X:</label><input name="cp1x-offset" id="cp1x-offset" data="offset_by_index cp1 x" type="text">
<label for="cp1y-offset">Y:</label><input name="cp1y-offset" id="cp1y-offset" data="offset_by_index cp1 y" type="text">
</div>
<p>Control Point 2</p>
<div class="point-input">
<label for="cp2x-offset">X:</label><input name="cp2x-offset" id="cp2x-offset" data="offset_by_index cp2 x" type="text">
<label for="cp2y-offset">Y:</label><input name="cp2y-offset" id="cp2y-offset" data="offset_by_index cp2 y" type="text">
</div>
</div>
</div>
<div class="input-wrapper bezier-type">
<h2>Points Scaling * Index</h2>
<div class="input-field-list">
<p>Point 1 (Start)</p>
<div class="point-input">
<label for="p1x-scale">X:</label><input name="p1x-scale" id="p1x-scale" data="scale_by_index p1 x" type="text">
<label for="p1y-scale">Y:</label><input name="p1y-scale" id="p1y-scale" data="scale_by_index p1 y" type="text">
</div>
<p>Point 2 (End)</p>
<div class="point-input">
<label for="p2x-scale">X:</label><input name="p2x-scale" id="p2x-scale" data="scale_by_index p2 x" type="text">
<label for="p2y-scale">Y:</label><input name="p2y-scale" id="p2y-scale" data="scale_by_index p2 y" type="text">
</div>
<p>Control Point 1</p>
<div class="point-input">
<label for="cp1x-scale">X:</label><input name="cp1x-scale" id="cp1x-scale" data="scale_by_index cp1 x" type="text">
<label for="cp1y-scale">Y:</label><input name="cp1y-scale" id="cp1y-scale" data="scale_by_index cp1 y" type="text">
</div>
<p>Control Point 2</p>
<div class="point-input">
<label for="cp2x-scale">X:</label><input name="cp2x-scale" id="cp2x-scale" data="scale_by_index cp2 x" type="text">
<label for="cp2y-scale">Y:</label><input name="cp2y-scale" id="cp2y-scale" data="scale_by_index cp2 y" type="text">
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>