How to connect/trigger elements in specific mouse-pressed combinations in p5.js (piano)

in setup() you can put the colors into an array like here:

something like this (or use append?)

  for (var i = 0; i < notes.length; i++) {
     colListForNotes[i] = lerpColor(color(255, 0, 0), color(0, 0, 255), i / notes.length);
  }

OR you type the color manually like

var colListForNotes =  [
   color(255, 0, 0),  
   color(252, 0, 0),
   ...
]; 
1 Like