/** * ControlP5 Matrix * * A matrix can be used for example as a sequencer, a drum machine. * * find a list of public methods available for the Matrix Controller * at the bottom of this sketch. * * by Andreas Schlegel, 2012 * www.sojamo.de/libraries/controlp5 * */ import controlP5.*; ControlP5 cp5; Dong[][] d; int nx = 10; int ny = 10; void setup() { size(700, 400); cp5 = new ControlP5(this); cp5.addMatrix("myMatrix") .setPosition(50, 100) .setSize(200, 200) .setGrid(nx, ny) .setGap(10, 1) .setInterval(200) .setMode(ControlP5.MULTIPLES) .setColorBackground(color(120)) .setBackground(color(40)) ; cp5.getController("myMatrix").getCaptionLabel().alignX(CENTER); // use setMode to change the cell-activation which by // default is ControlP5.SINGLE_ROW, 1 active cell per row, // but can be changed to ControlP5.SINGLE_COLUMN or // ControlP5.MULTIPLES d = new Dong[nx][ny]; for (int x = 0;x