-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgasket4.html
200 lines (190 loc) · 7.48 KB
/
gasket4.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>3D Sierpinski Gasket</title>
<link rel="stylesheet" href="index.css" />
<script id="vertex-shader" type="x-shader/x-vertex">
attribute vec3 vPosition;
attribute vec4 vColor;
varying vec4 color;
uniform mat4 modelViewMatrix;
void
main()
{
gl_Position = modelViewMatrix * vec4(vPosition, 1.0);
color = vColor;
}
</script>
<script id="fragment-shader" type="x-shader/x-fragment">
precision mediump float;
varying vec4 color;
void
main()
{
gl_FragColor = color;
}
</script>
<script type="text/javascript" src="./Common/webgl-utils.js"></script>
<script type="text/javascript" src="./Common/initShaders.js"></script>
<script type="text/javascript" src="./Common/MV.js"></script>
</head>
<body>
<div class="container">
<div class="sidebar">
<div class="sidebar-content">
<div class="sidebar-content-button-group">
<button id="animate">Start</button>
<button id="reset">Reset</button>
</div>
<div class="sidebar-content-title">
Gasket Properties
</div>
<div class="sidebar-content-group">
<label>Number of Subdivisions</label>
<div class="sidebar-content-range-group">
<input id="subdivisions" type="range" min=0 max=9 step=1 />
<div id="subdivisions-value">0</div>
</div>
</div>
<div class="sidebar-content-group">
<label>Colour (Face 1)</label>
<input id="colour-face-1-rgb" type="color" />
<div class="sidebar-content-range-group">
<div>A</div>
<input id="colour-face-1-a" type="range" min=0 max=1 step=0.01 />
<div id="colour-face-1-a-value">0</div>
</div>
</div>
<div class="sidebar-content-group">
<label>Colour (Face 2)</label>
<input id="colour-face-2-rgb" type="color" />
<div class="sidebar-content-range-group">
<div>A</div>
<input id="colour-face-2-a" type="range" min=0 max=1 step=0.01 />
<div id="colour-face-2-a-value">0</div>
</div>
</div>
<div class="sidebar-content-group">
<label>Colour (Face 3)</label>
<input id="colour-face-3-rgb" type="color" />
<div class="sidebar-content-range-group">
<div>A</div>
<input id="colour-face-3-a" type="range" min=0 max=1 step=0.01 />
<div id="colour-face-3-a-value">0</div>
</div>
</div>
<div class="sidebar-content-group">
<label>Colour (Face 4)</label>
<input id="colour-face-4-rgb" type="color" />
<div class="sidebar-content-range-group">
<div>A</div>
<input id="colour-face-4-a" type="range" min=0 max=1 step=0.01 />
<div id="colour-face-4-a-value">0</div>
</div>
</div>
<div class="sidebar-content-group">
<label>Background Colour</label>
<input id="colour-background-rgb" type="color" />
<div class="sidebar-content-range-group">
<div>A</div>
<input id="colour-background-a" type="range" min=0 max=1 step=0.01 />
<div id="colour-background-a-value">0</div>
</div>
</div>
<div class="sidebar-content-title">
Animation Properties
</div>
<div class="sidebar-content-group">
<label>Number of Iterations</label>
<div class="sidebar-content-range-group">
<input id="iterations" type="range" min=1 max=10 step=1 />
<div id="iterations-value">0</div>
</div>
</div>
<div class="sidebar-content-group">
<label>Speed</label>
<select id="speed">
<option value="very-slow">Very Slow</option>
<option value="slow">Slow</option>
<option value="normal">Normal</option>
<option value="fast">Fast</option>
<option value="very-fast">Very Fast</option>
</select>
</div>
<div class="sidebar-content-group">
<label>Rotation Angle (°)</label>
<div class="sidebar-content-radio-group">
<div>
<input type="radio" id="rotation-x" name="rotation-axis" value="x">
<label for="rotation-x">X Axis</label><br>
</div>
<div>
<input type="radio" id="rotation-y" name="rotation-axis" value="y">
<label for="rotation-y">Y Axis</label>
</div>
<div>
<input type="radio" id="rotation-z" name="rotation-axis" value="z">
<label for="rotation-z">Z Axis</label>
</div>
</div>
<div class="sidebar-content-range-group">
<input id="rotation" type="range" min=-180 max=180 step=1 />
<div id="rotation-value">0</div>
</div>
</div>
<div class="sidebar-content-group">
<label>Translation Magnitude</label>
<div class="sidebar-content-radio-group">
<div>
<input type="radio" id="translation-x" name="translation-axis" value="x">
<label for="translation-x">X Axis</label><br>
</div>
<div>
<input type="radio" id="translation-y" name="translation-axis" value="y">
<label for="translation-y">Y Axis</label>
</div>
<div>
<input type="radio" id="translation-z" name="translation-axis" value="z">
<label for="translation-z">Z Axis</label>
</div>
</div>
<div class="sidebar-content-range-group">
<input id="translation" type="range" min=-3 max=3 step=0.1 value=0/>
<div id="translation-value">0</div>
</div>
</div>
<div class="sidebar-content-group">
<label>Scaling Factor</label>
<div class="sidebar-content-radio-group">
<div>
<input type="radio" id="scale-x" name="scaling-axis" value="x">
<label for="scale-x">X Axis</label><br>
</div>
<div>
<input type="radio" id="scale-y" name="scaling-axis" value="y">
<label for="scale-y">Y Axis</label>
</div>
<div>
<input type="radio" id="scale-z" name="scaling-axis" value="z">
<label for="scale-z">Z Axis</label>
</div>
</div>
<div class="sidebar-content-range-group">
<input id="scaling" type="range" min=0 max=3.5 step=0.1 />
<div id="scaling-value">0</div>
</div>
</div>
</div>
</div>
<div id="content" class="content">
<canvas id="gl-canvas">
Oops ... your browser doesn't support the HTML5 canvas element
</canvas>
</div>
</div>
<script type="text/javascript" src="gasket4.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>
</html>