Skip to content

LaserPointerNode

Overview

A laser pointer, with optional on/off button (toggle or momentary). Default orientation is pointing to the right. Origin is at right center (the edge of the output nozzle).

@author Chris Malley (PixelZoom, Inc.)

Class LaserPointerNode

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

Constructor

new LaserPointerNode( onProperty : TProperty<boolean>, providedOptions? : LaserPointerNodeOptions )

Instance Methods

dispose()

Instance Properties

onOffButton : Node | null

(readonly)

Read-only access to see if the pointer is over the button specifically, ok to add listeners, but do not mutate.

Static Properties

DEFAULT_LASER_NODE_OPTIONS

(readonly)

Type LaserPointerNodeOptions

import type { LaserPointerNodeOptions } from 'scenerystack/scenery-phet';
  • bodySize?: Dimension2
    nozzle and body options
  • nozzleSize?: Dimension2
  • topColor?: TColor
  • bottomColor?: TColor
  • highlightColor?: TColor
  • highlightColorStop?: number
  • stroke?: TColor
  • lineWidth?: number
  • cornerRadius?: number
  • hasButton?: boolean
    button options
  • buttonType?: ButtonType
  • buttonOptions?: ButtonOptions
  • getButtonLocation?: ( bodyNode: Node ) => Vector2
    where to position the button within the body
  • hasGlass?: boolean
    When enabled, the glass shows a semi-circular blue-ish lens on the output of the laser pointer node. It does not change the origin of the laser pointer node, which is at the center of the casing. The glass is sometimes used to help cue the user that it is a non-laser light source. See https://github.com/phetsims/scenery-phet/issues/366
  • glassOptions?:
    propagated to ShadedSphereNode, used to draw the lens at the output of the laser pointer
  • heightProportion?: number
    The fraction of the nozzle height, between 0 (no height) and 1 (the nozzle height)
  • proportionStickingOut?: number
    The amount the glass "sticks out" between 0 (not at all) and 1 (hemisphere)
  • & ShadedSphereNodeOptions
  • & TrimParallelDOMOptions<NodeOptions>

Source Code

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