-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhydra.js
50 lines (45 loc) · 1.18 KB
/
hydra.js
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
var hydraCanvas = document.getElementById("hydraCanvas");
var aspectRatio = window.innerHeight / window.innerWidth;
hydraCanvas.width = 480;
// hydraCanvas.height = 480 * aspectRatio;
hydraCanvas.height = 480;
var hydra = new Hydra({
canvas: hydraCanvas
});
function flatten(arr) {
return arr.reduce(function(result, val) {
return result.concat(val)
}, []);
}
var customFunctions = flatten([
blendmodes_glsl_fns,
levels_glsl_fns,
css_filter_glsl_fns,
css_gradients_glsl_fns,
image_filter_fns,
book_of_shaders_fns,
distort_fns,
]);
var customFunctionNames = [];
customFunctions.forEach(function(fn) {
customFunctionNames.push(fn.name);
hydra.synth.setFunction(fn);
});
// blendmodes_glsl_fns.forEach(function(fn) {
// hydra.synth.setFunction(fn)
// });
// levels_glsl_fns.forEach(function(fn) {
// hydra.synth.setFunction(fn)
// });
// css_filter_glsl_fns.forEach(function(fn) {
// hydra.synth.setFunction(fn)
// });
// css_gradients_glsl_fns.forEach(function(fn) {
// hydra.synth.setFunction(fn)
// });
// image_filter_fns.forEach(function(fn) {
// hydra.synth.setFunction(fn)
// });
// book_of_shaders_fns.forEach(function(fn) {
// hydra.synth.setFunction(fn)
// });