Skip to content

FaucetNode

Overview

FaucetNode is a faucet with a pinball machine 'shooter' that behaves like a slider. When the faucet is disabled, the flow rate is set to zero and the shooter is disabled. The origin is at the bottom-center of the spout.

The shooter is optionally interactive. When it's not interactive, the shooter and track are hidden. When the shooter is interactive, it has the following features:

(1) Close-on-release mode: When the user drags the slider, releasing it sets the flow to zero. See options.closeToRelease: true.

(2) Slider mode: When the user drags the slider, releasing it will leave the shooter wherever it is released, and (if in the on position) the flow will continue. See options.closeToRelease: false.

(3) Tap-to-dispense: When the user taps on the shooter without dragging, it's on/off state toggles. If the shooter was in the off state when tapped, it opens and dispenses a configurable amount of fluid. This feature can be enabled simultaneously with (1) and (2) above. See the various tapToDispense* options.

@author Chris Malley (PixelZoom, Inc.)

Class FaucetNode

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

Constructor

new FaucetNode( maxFlowRate : number, flowRateProperty : Property<number>, enabledProperty : TReadOnlyProperty<boolean>, providedOptions? : FaucetNodeOptions )

Instance Methods

dispose()

Static Properties

CLOSE_FAUCET_HOTKEY_DATA : HotkeyData

(readonly)

TAP_TO_DISPENSE_HOTKEY_DATA : HotkeyData

(readonly)

FaucetNodeIO : IOType

Type FaucetNodeOptions

import type { FaucetNodeOptions } from 'scenerystack/scenery-phet';
  • horizontalPipeLength?: number
  • verticalPipeLength?: number
  • tapToDispenseEnabled?: boolean
  • tapToDispenseAmount?: number
  • tapToDispenseInterval?: number
  • closeOnRelease?: boolean
  • interactiveProperty?: TReadOnlyProperty<boolean>
  • rasterizeHorizontalPipeNode?: boolean
    Overcome a flickering problems, see https://github.com/phetsims/wave-interference/issues/187
  • shooterOptions?: ShooterNodeOptions
    options for the nested type ShooterNode
  • & StrictOmit<ParentOptions, "interactiveHighlightEnabled" | "enabledRangeProperty" | "valueProperty">

Source Code

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