Lume
    Preparing search index...

    Class ButtonGrid

    CircleGrid generates a grid of buttons, with each button representing a MIDI note.

    The default properties for ButtonGrid are configured to emulate the design of the MIDI Fighter 64, generating an 8 by 8 grid of buttons that light up when hit.

    Hierarchy (View Summary)

    Index

    Accessors

    • get boostThreshold(): number

      Returns the amount of time (in milleseconds) that a button takes to transition from it's boosted size and color to it's regular held values when it's activated.

      Returns number

    • set boostThreshold(value: number): void

      Sets the amount of time (in milleseconds) that a abutton takes to transition from it's boosted size and color to it's regular held values when it's activated.

      Value must be a positive number.

      Parameters

      • value: number

      Returns void

    • get buttonRadius(): number

      Returns the radius (in pixels) for each button.

      Returns number

    • set buttonRadius(value: number): void

      Sets the radius (in pixels) for each button. Value must be a positive number.

      Parameters

      • value: number

      Returns void

    • get gap(): number

      Returns the value of the gap property.

      Note that this property does not refer to the actual spacing between buttons, but as internal value used for calculations.

      Returns number

    • set gap(value: number): void

      Sets the value of the gap property.

      Parameters

      • value: number

      Returns void

      Value must be zero or greater.

    • get gridHeight(): number

      Returns the amount of buttons in each column.

      Returns number

    • set gridHeight(value: number): void

      Sets the amount of buttons that appear in each column. Value must be greater than zero.

      Parameters

      • value: number

      Returns void

    • get gridWidth(): number

      Returns the amount of buttons in each row.

      Returns number

    • set gridWidth(value: number): void

      Sets the amount of buttons that appear in each row. Value must be greater than zero.

      Parameters

      • value: number

      Returns void

    • get isFadeToBackground(): boolean

      Returns the isFadeToBackground flag, which if true, fades buttons immediately to the idle color rather than holding.

      Returns boolean

    • set isFadeToBackground(value: boolean): void

      Sets the isFadeToBackground flag.

      Set this property to true if you want to represent MIDI notes without sustain, typically on percussive instruments.

      ButtonGrid will immediately render a note as inactive if the note duration is shorter than the boost threshold, as it cannot track notes that aren't currently being played.

      Parameters

      • value: boolean

      Returns void

    • get ringThickness(): number

      Returns the width (in pixels) for the ring that separates the core of each button from the edge.

      Returns number

    • set ringThickness(value: number): void

      Sets the width (in pixels) for the ring that separates the core of each button from the edge. Setting the ring thickness to a value of zero will make the button a circle.

      Value must be a positive number.

      Parameters

      • value: number

      Returns void

    • get rootNote(): number

      Returns the root note -- the lowest note that can be read by ButtonGrid.

      Returns number

    • set rootNote(value: number): void

      Sets the root note. Value must be greater than zero.

      Parameters

      • value: number

      Returns void

    • get sizeBoost(): number

      Returns the amount (in pixels) that the buttons increase when hit.

      Returns number

    • set sizeBoost(value: number): void

      Sets the amount (in pixels) that the buttons increase when hit.

      Value must be greater or equal to zero. Setting this value to zero means that the buttons never change in size.

      Parameters

      • value: number

      Returns void

    Constructors

    Methods

    • 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

      Returns void