Skip to content

Stopwatch

Overview

Stopwatch is the model for the stopwatch. It is responsible for time, position, and visibility.

@author Chris Malley (PixelZoom, Inc.)

Class Stopwatch

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

Constructor

new Stopwatch( providedOptions? : StopwatchOptions )

Instance Methods

dispose()

reset()

step( dt : number )

Steps the stopwatch. @param dt - time delta, in units as specified by the client

setTime( t : number )

Similar to step() but sets the time to a specific value. @param t

Instance Properties

positionProperty : Property<Vector2>

(readonly)

position of the stopwatch, in view coordinates

isVisibleProperty : Property<boolean>

(readonly)

whether the stopwatch is visible

isRunningProperty : Property<boolean>

(readonly)

whether the stopwatch is running

timeProperty : NumberProperty

(readonly)

time displayed on the stopwatch, in units as specified by the client

Static Properties

ZERO_TO_ALMOST_SIXTY : Range

(readonly)

Type StopwatchOptions

import type { StopwatchOptions } from 'scenerystack/scenery-phet';

Source Code

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