OAVp5.panel.open()#
functionoav-p5OAVp5.panel.open()Also: OAVp5.panel.close OAVp5.panel.toggle
Opens the 🎹 panel (open()), closes it (close()) or flips it (toggle()).
Same as pressing the 🎹 button. The first time the panel opens, oav-p5 loads the on-screen controller (a few seconds on a slow connection, which the panel says while it loads), and if hardware is click it asks for Web MIDI then. OAVp5.panel.open() when it is already open does nothing new.
Returns
Promise<Element | null> A promise. open() (and toggle() when it opens) resolves to the panel's element once the on-screen controller inside it has loaded, and the panel is on screen at once, before that. close() (and toggle() when it closes) resolves to null, and so does everything when the panel option is off.
Notes
- The three are listed together here:
OAVp5.panel.closeandOAVp5.panel.toggletake no arguments either.midi.panel.open()is the same function.
Examples
function setup() {
createCanvas(400, 300);
}
function keyPressed() {
if (key === 'o') OAVp5.panel.open();
if (key === 'c') OAVp5.panel.close();
}
function draw() {
background(20);
fill(255);
text('o: open the 🎹 panel, c: close it', 20, 30);
}function setup() {
createCanvas(400, 300);
}
function mousePressed() {
OAVp5.panel.open().then((panel) => console.log('the panel is', panel ? 'open and loaded' : 'not available'));
}
function draw() {
background(20);
fill(255);
text('click the canvas to open the panel', 20, 30);
}Related
OAVp5.panelThe 🎹 panel as an object:open(),close()andtoggle()show and hide it from code.panelWhether the 🎹 panel starts shut, open, or does not exist:closed,openoroff.OAVp5.phone()Shows the 📱 card: a QR code that sends a phone to the remote page, whose MIDI tab then plays this sketch. Returns the room name.OAVp5.check()Runs the 🩺 check-up: the version, page, browser, microphone, MIDI, sound, drums, recording, wiring and hints, as a card to screenshot and as an object.