Home Reference Source Repository
public class | source

Button

Represents a button on the Launchpad.

Constructor Summary

Public Constructor
public

constructor(launchpad: Launchpad, note: Number)

Creates an instance of Button.

Member Summary

Public Members
public

The current color of the button.

public

The Launchpad this button belongs to.

public

The note representation of this button.

public

The x-coordinate of this button.

public

The y-coordinate of this button.

Method Summary

Public Methods
public

darken()

Convenience method for setting the button's color to 0.

public

pulseColor(color: Number)

Pulse a color in and out on a button/

public

setColor(color: Number)

Set the color of this button.

public

Set a color on the button with RGB values.

Public Constructors

public constructor(launchpad: Launchpad, note: Number) source

Creates an instance of Button. You shouldn't need to use this, Buttons are generated with a Launchpad instance.

Params:

NameTypeAttributeDescription
launchpad Launchpad

The Launchpad this button belongs to.

note Number

The note representation of the button, used when sending messages to the Launchpad.

Public Members

public color: Number source

The current color of the button.

public launchpad: Launchpad source

The Launchpad this button belongs to.

public note: Number source

The note representation of this button.

public x: Number source

The x-coordinate of this button.

public y: Number source

The y-coordinate of this button.

Public Methods

public darken() source

Convenience method for setting the button's color to 0.

Example:

var button = launchpad.getButton(0, 0)
button.darken()

public pulseColor(color: Number) source

Pulse a color in and out on a button/

Params:

NameTypeAttributeDescription
color Number

The note representation of the color.

Example:

var button = launchpad.getButton(0, 0)
button.pulseColor(2)

public setColor(color: Number) source

Set the color of this button.

Params:

NameTypeAttributeDescription
color Number

The note representation of the color.

Example:

var button = launchpad.getButton(0, 0)
button.setColor(2)

public setRgbColor(r: Number, g: Number, b: Number) source

Set a color on the button with RGB values.

Params:

NameTypeAttributeDescription
r Number

Red value. 0-63

g Number

Green value. 0-63

b Number

Blue value. 0-63

Example:

var button = launchpad.getButton(0, 0)
button.setRgbColor(255, 255, 255) // set color to white