-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdemo.js
More file actions
28 lines (22 loc) · 678 Bytes
/
demo.js
File metadata and controls
28 lines (22 loc) · 678 Bytes
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
var buf = new Float32Array(200000);
for (var i=0; i<buf.length; i++) {
buf[i] = Math.sin(i / 100000) * Math.sin(i * Math.sin(i / 10000) / 50);
}
function gebi(id) {
return document.getElementById(id);
}
var wave = new Wave(gebi("wave"), {
buf: buf,
waveStyle: 'darkgreen',
pointFunc: Wave.Squares
});
wave.bound = true;
wave.zoomby(0.01); /* zoom out */
gebi("zin").onclick = function() { wave.zoomby(200); };
gebi("zout").onclick = function() { wave.zoomby(50); };
gebi("i").onclick = function() { wave.invalidate(); };
gebi("wave").addEventListener('click',
function (e) {
wave.addbar(wave.getPos(e).pos);
},
false);