faderMoved()#
eventoav-p5function faderMoved(n, value) {}
You define this function; oav-p5 calls it whenever a fader moves.
The fader twin of knobMoved(): function faderMoved(n, value) { … }.
Parameters
| Name | Type | Description |
|---|---|---|
n | Number | Which fader (1 is the first). |
value | Number | Where it is now, 0..1. |
Examples
let level = 0;
function setup() {
createCanvas(400, 300);
}
function faderMoved(n, value) {
if (n === 1) level = value; // fader 1 only
}
function draw() {
background(20);
fill(255);
rect(40, height - 40, level * (width - 80), 24);
}Related
fader1The position of a controller fader (slider), from 0 to 1:fader1is the first fader, up tofader8.knobMoved()You define this function; oav-p5 calls it whenever a knob moves.controlChange()You define this function; oav-p5 calls it for every MIDI control change (a knob, a fader, the mod wheel, the sustain pedal), whether or not the controller is known.