Skip to content

TimeControlNode

Overview

TimeControlNode provides a UI for controlling time. It includes a play/pause button, step-forward button, optional step-backward button, and optional radio buttons for time speed. Various layouts are supported via options.

@author Denzell Barnett (PhET Interactive Simulations) @author Jonathan Olson <jonathan.olson@colorado.edu> @author Chris Malley (PixelZoom, Inc.) @author Jesse Greenberg (PhET Interactive Simulations)

Class TimeControlNode

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

Constructor

new TimeControlNode( isPlayingProperty : Property<boolean>, providedOptions? : TimeControlNodeOptions )

Instance Methods

addPushButton( pushButton : RoundPushButton, index : number )

Add a push button to the TimeControlNode.

Instance Properties

pushButtonGroup : PlayPauseStepButtonGroup

(protected, readonly)

push button for play/pause and (optionally) step forward, step back

Type TimeControlNodeOptions

import type { TimeControlNodeOptions } from 'scenerystack/scenery-phet';
  • timeSpeedProperty?: EnumerationProperty<TimeSpeed> | null
    Play speed Property for the radio button group. If null, no radio buttons included in this control.
  • timeSpeeds?: TimeSpeed[]
    Speeds supported by this TimeControlNode. Vertical radio buttons are created for each in the order provided.
  • speedRadioButtonGroupPlacement?: "left" | "right" | "top" | "bottom"
    speed radio buttons placement relative to the play/pause button group
  • playPauseStepButtonOptions?: PlayPauseStepButtonGroupOptions
    options passed along to the PlayPauseStepButtons, see the inner class for defaults
  • speedRadioButtonGroupOptions?: StrictOmit<TimeSpeedRadioButtonGroupOptions, "tandem">
    options passed along to the SpeedRadioButtonGroup, if included
  • flowBoxAlign?: HorizontalLayoutAlign | VerticalLayoutAlign
    Alignment of the FlowBox containing the buttons
  • flowBoxSpacing?: number
    horizontal space between PlayPauseStepButtons and SpeedRadioButtonGroup, if SpeedRadioButtonGroup is included
  • & StrictOmit<NodeOptions, "children">

Source Code

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