Whenever item N is pressed, on the screen it triggers N+1, and this bit of code is responsible for it:
// script.js :: [line 31]
// https://gitlab.com/woshibide/p5js-sound-sampler/-/blob/master/sketch.js#L31)
if (this.isPressed) {
fill(this.color.levels.map(x => x - 50)); // darker shade when pressed
} else {
fill(this.color);
}
I tried debugging it (here, if you open console you will find console.log vals on QWEASD keys pressed), but just couldn’t figure out what is wrong with it. Sounds play correctly, buttons trigger corresponded actions. The whole deal is about next item on the list appearing shaded, instead of the desired one
help! i’m new to js and p5js and programming in general
p.s. does this toy have a potential to be contributed to p5js?
This is my first question here, i provided gitlab repo with anchor link straight to the pain point, as well as working version avaialable on surge. Is it not the way how it is done? How do I provide code which is like 150 lines?