Returns the areBlackKeysFilled flag, which when true makes the black keys have the same color as the white keys.
Sets the areBlackKeysFilled flag.
Sets the vertical offset between black and white keys.
Gets the corner radius of the keys.
Sets the value of the gap property.
Internally, Keyboard draws keys by creating an outline around rectangles. These outlines are exculuded from size calculations, meaning that a negative key spacing is possible, which would make the last key on the keyboard larger than the rest (as they're drawn sequentially).
Returns the isFadeToBackground flag, which if true, fades buttons immediately to the idle color rather than holding.
Sets the isFadeToBackground flag.
Set this property to true if you want to represent MIDI notes without sustain, typically on percussive instruments.
Note that notes will immediately render as inactive if the note duration is shorter than the boost threshold, as it cannot track notes that aren't currently being played.
Returns the noteEnvelope, which is used to calculate the color and size of active notes.
The release property of the envelope is unused, as this drawer does not keep track of notes once they've been deactivated.
Default (no argument) instance of ADSREnvelope.
Returns the amount that the keys increase in size when hit.
Returns the spacing between keys.
Spacing is defined as the distance between the horizontal center of one key to the horizontal center of another.
Called by the rendering engine on every frame.
When overriding this method, ensure that the p5 instance is configured properly. For example, rectangles may be drawn incorrectly if a previous CanvasDrawer had modified p5.rectMode(). CanvasDrawer classes are not obligated/expected to use the default p5 attributes.
See the p5 documentation on attributes for more information: https://p5js.org/reference/#Attributes
Invoked by the rendering engine to generate a frame.
Sets the height of both white and black keys.
The height of all keys.
Sets the height of the white and black keys.
Height of the white keys.
Height of the black keys.
Sets the width of the white and black keys.
Width of the white keys.
Width of the black keys.
Sets the width of both white and black keys.
The width of all keys.
The Keyboard CanvasDrawer dynamically generates a row of keys based on the layout of a standard piano keyboard, with the notes in the C major scale serving as the white keys, with inverted, smaller black keys inbetween them.
Example: Generates a keyboard layout similar to the layout of a piano.