Skip to content

ThermometerNode

Overview

Thermometer node, see https://github.com/phetsims/scenery-phet/issues/43

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

Class ThermometerNode

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

Constructor

new ThermometerNode( temperatureProperty : TReadOnlyProperty<number | null>, minTemperature : number, maxTemperature : number, providedOptions? : ThermometerNodeOptions )

Instance Methods

dispose()

temperatureToYPos( temperature : number | null ) : number

Get y position at temperature to allow accurate tick placement @param temperature - temperature at which to find y position, null is treated as the provided minTemperature

yPosToTemperature( y : number ) : number

Get temperature at y position to allow temperature thumb mapping @param y - y position on thermometer node

Type ThermometerNodeOptions

import type { ThermometerNodeOptions } from 'scenerystack/scenery-phet';
  • bulbDiameter?: number
  • tubeWidth?: number
  • tubeHeight?: number
  • lineWidth?: number
  • outlineStroke?: TColor
  • tickSpacing?: number
  • tickSpacingTemperature?: number | null
    overrides tickSpacing to space ticks by units of temperature
  • majorTickLength?: number
  • minorTickLength?: number
  • glassThickness?: number
    space between the thermometer outline and the fluid inside it
  • zeroLevel?: ZeroLevel
    defines where level is at temperature zero - 'bulbCenter' or 'bulbTop'
  • backgroundFill?: TColor
    leave as null to have a transparent background. If a color is given, then an extra Rectangle is created for the background
  • fluidMainColor?: TColor
    the main color of the bulb fluid, and the left side of the tube gradient
  • fluidHighlightColor?: TColor
    the highlight color of the bulb fluid and the middle of the tube gradient
  • fluidRightSideColor?: TColor
    the right side of the tube gradient, not used currently
  • & NodeOptions

Source Code

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