Reference emissiveMaterial()

emissiveMaterial()

Sets the emissive color of shapes’ surface material.

The emissiveMaterial() color sets a color shapes display at full strength, regardless of lighting. This can give the appearance that a shape is glowing. However, emissive materials don’t actually emit light that can affect surrounding objects.

emissiveMaterial() can be called three ways with different parameters to set the material’s color.

The first way to call emissiveMaterial() has one parameter, gray. Grayscale values between 0 and 255, as in emissiveMaterial(50), can be passed to set the material’s color. Higher grayscale values make shapes appear brighter.

The second way to call emissiveMaterial() has one parameter, color. A p5.Color object, an array of color values, or a CSS color string, as in emissiveMaterial('magenta'), can be passed to set the material’s color.

The third way to call emissiveMaterial() has four parameters, v1, v2, v3, and alpha. alpha is optional. RGBA, HSBA, or HSLA values can be passed to set the material’s colors, as in emissiveMaterial(255, 0, 0) or emissiveMaterial(255, 0, 0, 30). Color values will be interpreted using the current colorMode().

Note: emissiveMaterial() can only be used in WebGL mode.

Examples

Syntax

emissiveMaterial(v1, v2, v3, [alpha])
emissiveMaterial(gray)
emissiveMaterial(color)

Parameters

v1
Number:

red or hue value in the current colorMode().

v2
Number:

green or saturation value in the current colorMode().

v3
Number:

blue, brightness, or lightness value in the current colorMode().

alpha
Number:

alpha value in the current colorMode().

gray
Number:

grayscale value between 0 (black) and 255 (white).

color
p5.Color|Number[]|String:

color as a p5.Color object, an array of color values, or a CSS string.

Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/material.js and open a pull request!

Related References