-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
211 lines (206 loc) · 11 KB
/
index.html
File metadata and controls
211 lines (206 loc) · 11 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8">
<meta name="viewport" content="width=device-width">
<title>Leaf Venation</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
padding: 0;
margin: 0;
overflow: hidden;
width: 100%;
height: 100%;
cursor: crosshair;
font-family: monospace;
}
input,
button {
font-family: inherit;
}
#mainCanvas {
width: 100%;
height: 100%;
}
#leafContourCanvas {
display: none;
}
.dependContourStroke,
.dependContourFill,
.dependAuxinSourceFill,
.dependVeinWidthAnimated {
display: none;
}
tr:has(input[name=contourStroke]:checked) ~ tr.dependContourStroke,
tr:has(input[name=contourFill]:checked) ~ tr.dependContourFill,
tr:has(input[name=auxinSourceFill]:checked) ~ tr.dependAuxinSourceFill,
tr:has(input[name=veinWidthAnimated]:checked) ~ tr.dependVeinWidthAnimated {
display: table-row;
}
#leafContourCanvasInput {
border: 1px solid black;
}
@media (max-width: 800px) {
.hide-on-mobile {
display: none;
}
}
</style>
</head>
<body>
<canvas id="mainCanvas"></canvas>
<canvas id="leafContourCanvas"></canvas>
<dialog id="startMenu">
<h1>Leaf Venation Pattern Generator</h1>
<p>
This tool generates leaf venation patterns using the algorithm
described in <i>Modeling and visualization of leaf venation patterns</i>
by Adam Runions, Martin Fuhrer, Brendan Lane, Pavol Federl,
Anne-Gaëlle Rolland-Lagan and Przemyslaw Prusinkiewicz.
Please refer to the paper for details about parameters.
<br>
This tool serves no purpose other than being fun, so please have fun with it.
</p>
<form id="optionsForm">
<input id="inputLeafContourPoints" name="leafContourPoints" hidden>
<input id="inputLeafContourOrigin" name="leafContourOrigin" hidden>
<input id="inputOrigin" name="leafOrigin" hidden>
<table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td><label for="input-birthDistanceAuxinSource">Birth distance from auxin sources (px)</label></td>
<td><input id="input-birthDistanceAuxinSource" type="number" name="birthDistanceAuxinSource" value="10" step="0.001" min="0"></td>
</tr>
<tr>
<td><label for="input-birthDistanceVeinNode">Birth distance from vein nodes (px)</label></td>
<td><input id="input-birthDistanceVeinNode" type="number" name="birthDistanceVeinNode" value="10" step="0.001" min="0"></td>
</tr>
<tr>
<td><label for="input-killDistance">Kill distance (px)</label></td>
<td><input id="input-killDistance" type="number" name="killDistance" value="40" step="0.001" min="0"></td>
</tr>
<tr>
<td><label for="input-birthDensity">Birth density (/px²)</label></td>
<td><input id="input-birthDensity" type="number" name="birthDensity" value="0.000001" step="0.0000001" min="0"></td>
</tr>
<tr>
<td><label for="input-veinLength">Vein length (px)</label></td>
<td><input id="input-veinLength" type="number" name="veinLength" value="1" step="0.001" min="0"></td>
</tr>
<tr>
<td><label for="input-leafGrowth">Leaf growth (px/it)</label></td>
<td><input id="input-leafGrowth" type="number" name="leafGrowth" value="0" step="0.001" min="0"></td>
</tr>
<tr>
<td><label for="input-marginalGrowth">Marginal growth</label></td>
<td><input id="input-marginalGrowth" name="marginalGrowth" type="checkbox"></td>
</tr>
<tr>
<td><label for="input-initialLeafLength">Initial leaf length (px)</label></td>
<td><input id="input-initialLeafLength" type="number" name="initialLeafLength" value="100" step="1" min="0"></td>
</tr>
<tr>
<td><label for="input-finalLeafLength">Final leaf length (px)</label></td>
<td><input id="input-finalLeafLength" type="number" name="finalLeafLength" value="900" step="1" min="0"></td>
</tr>
</tbody>
</table>
</td>
<td class="hide-on-mobile">
<span>Leaf origin / contour (shift)</span><br>
<canvas id="leafContourCanvasInput" width="256" height="256"></canvas>
</td>
</tr>
</tbody>
</table>
<hr>
<table>
<tbody>
<tr>
<td><label for="input-backgroundColor">Background color</label></td>
<td><input id="input-backgroundColor" name="backgroundColor" type="color" value="#1c1b22"></td>
</tr>
<tr>
<td><label for="input-veinColor">Vein color</label></td>
<td><input id="input-veinColor" name="veinColor" type="color" value="#8b0404"></td>
</tr>
<tr>
<td><label for="input-veinWidthExponent">Vein width exponent</label></td>
<td><input id="input-veinWidthExponent" name="veinWidthExponent" type="number" value="3" step="0.001" min="0"></td>
</tr>
<tr>
<td><label for="input-veinWidthBase">Vein width base (px)</label></td>
<td><input id="input-veinWidthBase" name="veinWidthBase" type="number" value="1" step="0.001" min="0"></td>
</tr>
<tr>
<td><label for="input-veinWidthMax">Vein width max (px)</label></td>
<td><input id="input-veinWidthMax" name="veinWidthMax" type="number" value="5" step="0.001" min="0"></td>
</tr>
<tr>
<td><label for="input-contourStroke">Draw leaf contour</label></td>
<td><input id="input-contourStroke" name="contourStroke" type="checkbox"></td>
</tr>
<tr class="dependContourStroke">
<td><label for="input-contourStrokeColor">Contour stroke color</label></td>
<td><input id="input-contourStrokeColor" name="contourStrokeColor" type="color" value="#000000"></td>
</tr>
<tr class="dependContourStroke">
<td><label for="input-contourStrokeWidth">Contour stroke width (px)</label></td>
<td><input id="input-contourStrokeWidth" name="contourStrokeWidth" type="number" value="1" step="1" min="0"></td>
</tr>
<tr>
<td><label for="input-contourFill">Fill leaf contour</label></td>
<td><input id="input-contourFill" name="contourFill" type="checkbox"></td>
</tr>
<tr class="dependContourFill">
<td><label for="input-contourFillColor">Contour fill color</label></td>
<td><input id="input-contourFillColor" name="contourFillColor" type="color" value="#cccccc"></td>
</tr>
<tr>
<td><label for="input-auxinSourceFill">Draw auxin sources</label></td>
<td><input id="input-auxinSourceFill" name="auxinSourceFill" type="checkbox"></td>
</tr>
<tr class="dependAuxinSourceFill">
<td><label for="input-auxinSourceColor">Auxin source color</label></td>
<td><input id="input-auxinSourceColor" name="auxinSourceColor" type="color" value="#dc143c"></td>
</tr>
<tr class="dependAuxinSourceFill">
<td><label for="input-auxinSourceRadius">Auxin source radius (px)</label></td>
<td><input id="input-auxinSourceRadius" name="auxinSourceRadius" type="number" value="1" step="0.1" min="0"></td>
</tr>
<tr>
<td><label for="input-veinWidthAnimated">Animate vein width</label></td>
<td><input id="input-veinWidthAnimated" name="veinWidthAnimated" type="checkbox" checked></td>
</tr>
<tr class="dependVeinWidthAnimated">
<td><label for="input-veinWidthXFrequency">Vein width animation spatial X frequency (/px)</label></td>
<td><input id="input-veinWidthXFrequency" name="veinWidthXFrequency" type="number" value="0.013" step="0.001" min="0"></td>
</tr>
<tr class="dependVeinWidthAnimated">
<td><label for="input-veinWidthYFrequency">Vein width animation spatial Y frequency (/px)</label></td>
<td><input id="input-veinWidthYFrequency" name="veinWidthYFrequency" type="number" value="0.007" step="0.001" min="0"></td>
</tr>
<tr class="dependVeinWidthAnimated">
<td><label for="input-veinWidthTimeFrequency">Vein width animation time frequency (Hz)</label></td>
<td><input id="input-veinWidthTimeFrequency" name="veinWidthTimeFrequency" type="number" value="1" step="0.001" min="0"></td>
</tr>
<tr class="dependVeinWidthAnimated">
<td><label for="input-veinWidthAmplitude">Vein width animation amplitude</label></td>
<td><input id="input-veinWidthAmplitude" name="veinWidthAmplitude" type="number" value="0.5" step="0.001" min="0"></td>
</tr>
</tbody>
</table>
<button type="submit">Start</button>
</form>
</dialog>
<script src="master.js"></script>
</body>
</html>