Skip to content

SpectrumNode

Overview

SpectrumNode displays a color spectrum for a range of values. By default, it maps values in the range [0,1] to the grayscale spectrum. The client can provide a different range, and different method of mapping value to color.

@author Chris Malley (PixelZoom, Inc.) @author Sam Reid (PhET Interactive Simulations)

Class SpectrumNode

import { SpectrumNode } from 'scenerystack/scenery-phet';

Constructor

new SpectrumNode( providedOptions? : SpectrumNodeOptions )

Instance Methods

Static Properties

DEFAULT_VALUE_TO_COLOR

(readonly)

value is [0,1] and maps to the grayscale spectrum

Type SpectrumNodeOptions

import type { SpectrumNodeOptions } from 'scenerystack/scenery-phet';
  • size?: Dimension2
    dimensions of the spectrum
  • valueToColor?: ( value: number ) => Color
    maps value to Color, range of value is determined by the client
  • minValue?: number
    min value to be mapped to Color via valueToColor
  • maxValue?: number
    max value to be mapped to Color via valueToColor
  • & StrictOmit<NodeOptions, "children">

Source Code

See the source for SpectrumNode.ts in the scenery-phet repository.