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

OR we can make a parallel 2nd array I already talked about: it would store the information if the ellipse is colored or not. When we have an array of color we switch the current ellipse permanently from white to its color

Remark

I just realized that you want to continuously fill the spiral from the center during playing and that the color used stems from the key that has been played.

This is also possible. Just track how many notes have been played with a new variable like counter and use it as an index for your ellipse color array

Copy the color from the piano below into the ellipse color array
at index counter

when a song is finished, we could leave the empty ellipses out (don’t show them) and enlarge the image of the colored ellipses

please ask when you need help or show your attempt

1 Like