open-audiovisual
Search GitHub

oav-p5 reference · MIDI: knobs, faders, pads, keys

fader()#

functionoav-p5
fader(n)

Returns the position of fader number n, from 0 to 1: the same as fader1 to fader8, for any n.

The function form of fader1, for when the fader's number is a variable.

Parameters

NameTypeDescription
nNumberWhich fader, counting from 1.

Returns

Number The fader's position, 0..1; 0 until it has moved.

Examples

jsOpenProcessing ↗
function setup() {
  createCanvas(400, 300);
}

function draw() {
  background(20);
  fill(255);
  for (let i = 1; i <= 4; i++) circle(i * 80, height - 40 - fader(i) * 200, 30);
}
Four dots that rise with four faders.

Related

  • fader1 The position of a controller fader (slider), from 0 to 1: fader1 is the first fader, up to fader8.
  • knob() Returns the position of knob number n, from 0 to 1: the same as knob1 to knob8, for any n.
  • pad() Returns how hard pad number n is pressed, 0 to 1: the same as pad1 to pad16, for any n.

p5/oav-p5.js, line 361

↑ Back to top · All names