forked from benbenbenbenbenbenbenbenben/push2.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
64 lines (52 loc) · 1.89 KB
/
example.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
<html>
<script src="push2.js">
</script>
<script src="push2colours.js">
</script>
<body>
<h1>push2.js example</h1>
<p>
If this has worked, you should seem some random lights flashing on your Push 2. If not, open the Javascript console and check for errors. There you'll also be able to see text output when you interact with the Push buttons and encoders.
</p>
<script>
window.requestAnimFrame = (function(callback)
{
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000 / 60);
};
})();
var push2 = new Push2();
push2.initialise(function () {
console.log("MIDI initialised")
push2.allLightsOff();
push2.setPadColour(0, 0, push2.colour(128, 0, 255));
push2.setPadColour(1, 5, push2.colour(255, 0, 0));
push2.setPadColour(1, 6, push2.colour(255, 0, 0));
push2.setPadColour(2, 5, push2.colour(50, 100, 255), push2.transition.blink);
push2.setPadColour(2, 6, push2.colour(255, 255, 128), push2.transition.pulse, push2.speed.half);
push2.setButtonColour(
push2.buttons.duplicate,
push2.white(0),
push2.transition.pulse);
push2.setButtonColour(
push2.buttons.duplicate,
push2.white(255),
push2.transition.blink);
push2.setScreenTopButtonColour(3, push2.colour(0, 0, 255));
push2.setScreenBottomButtonColour(4, push2.colour(0, 255, 255));
push2.setSceneLaunchButtonColour(6, push2.colour(255, 255, 255));
push2.setTouchstripFlags({
pushControlsLEDs: false,
hostSendsValues: true,
valuesSentAsPitchBend: false,
ledsShowPoint: false,
barStartsAtBottom: true,
autoreturn: false,
autoreturnToCenter: false
});
push2.setTouchstripValue(60);
});
</script>
</body>
</html>