padReleased()#
eventoav-p5function padReleased(n) {}
You define this function; oav-p5 calls it each time a drum pad is let go.
The partner of padPressed(): function padReleased(n) { … }. Without it, a pad calls noteReleased().
Parameters
| Name | Type | Description |
|---|---|---|
n | Number | Which pad (1 is the first). |
Examples
let down = {};
function setup() {
createCanvas(400, 300);
}
function padPressed(n) { down[n] = true; }
function padReleased(n) { down[n] = false; }
function draw() {
background(20);
fill(255, 90, 31);
for (let i = 1; i <= 8; i++) if (down[i]) square(10 + (i - 1) * 48, 130, 40); // lit while held
}Related
padPressed()You define this function; oav-p5 calls it each time a drum pad is hit.pad1How hard a drum pad is pressed, from 0 to 1:pad1is the first pad, up topad16; 0 when it is let go.noteReleased()You define this function; oav-p5 calls it each time a key (or a pad) is let go.