API Docs for: 0.0.8
Show:

Overtime Class

Defined in: src\overtime.js:7

A time limit visualization library.

Constructor

Overtime

(
  • [options]
)

Defined in src\overtime.js:7

Parameters:

  • [options] Object optional
    • The settings.
    • [time] Number optional
      • The time limit.
    • [canvas] Number optional
      • The canvas to use. A new one will be created if none is supplied.
    • [clearCanvas=true] Boolean optional
      • Whether the canvas should be cleared before rendering.
    • [size] Array optional
      • The size of the canvas.
    • [timeMeasure=Overtime.TimeMeasure.SECONDS] Overtime.TimeMeasure optional
      • The time measure of the supplied time limit.

Methods

_render

() private

Defined in src\overtime.js:332

Renders the time progress on the canvas.

_update

() private

Defined in src\overtime.js:375

Steps the system forward. This is the main loop.

advanceBy

(
  • t
)

Defined in src\overtime.js:474

Goes ahead in time by a given value.

Parameters:

  • t Number
    • The time value by which to rewind. Will be interpreted according to the current time measure. A negative value corresponds to rewinding.

persist

() private

Defined in src\overtime.js:214

Stores the time values for the next session.

prolongBy

(
  • t
)

Defined in src\overtime.js:489

Adds time.

Parameters:

  • t Number
    • The time value to add. Will be interpreted according to the current time measure. A negative value corresponds to shortening.

rewind

()

Defined in src\overtime.js:442

Sets the time back to its original length.

rewindBy

(
  • t
)

Defined in src\overtime.js:455

Sets the time back by the given value. The time will not go back beyond the initial length.

Parameters:

  • t Number
    • The time by which to rewind. Interpreted according to the current time measure. A negative value corresponds to fast-forwarding.

shortenBy

(
  • t
)

Defined in src\overtime.js:509

Reduces the total duration of the countdown.

Parameters:

  • t Number
    • The time value to subtract. Will be interpreted according to the current time measure. A negative value corresponds to prolonging.

start

()

Defined in src\overtime.js:427

Tries to start the rendering cycle if it isn't running. Otherwise it restarts it.

stop

()

Defined in src\overtime.js:412

Stops the rendering cycle. Does nothing else besides that.

update

()

Defined in src\overtime.js:230

The update function.

Properties

animId

Number private

Defined in src\overtime.js:57

Animation id of the currently requested frame.

canvas

HTMLCanvasElement

Defined in src\overtime.js:242

The internal canvas.

clearCanvas

Boolean

Defined in src\overtime.js:48

Clear canvas flag.

ctx

CanvasRenderingContext2D private

Defined in src\overtime.js:87

The rendering context.

fullCircle

Number private

Defined in src\overtime.js:120

Radians of the full circle plus the start angle.

HALF_PI

Number private final

Defined in src\overtime.js:37

PI / 2.

now

Number private

Defined in src\overtime.js:67

Used for time-based rendering.

primaryStrokeStyle

String

Defined in src\overtime.js:130

Colour of the progressing circle.

Default: rgba(255, 100, 0, 0.9)

secondaryStrokeStyle

String

Defined in src\overtime.js:140

Colour of the empty circle.

Default: rgba(0, 0, 0, 0.1)

size

Number

Defined in src\overtime.js:303

The size of the canvas.

Example:

[width, height]

startAngle

Number private

Defined in src\overtime.js:100

the start angle.

t

Number private

Defined in src\overtime.js:169

The remaining time in milliseconds.

T

Number private

Defined in src\overtime.js:191

The total time.

then

Number private

Defined in src\overtime.js:77

Used for time-based rendering.

threshold

Number private

Defined in src\overtime.js:110

A float threshold for the chrome rendering hack.

time

Number

Defined in src\overtime.js:263

The time. When set, the given value will be translated to the current time measure.

TimeMeasure

Object final static

Defined in src\overtime.js:524

Enumeration of time measure constants.

timeMeasure

Overtime.TimeMeasure

Defined in src\overtime.js:284

The current time measure. The current time will not be affected by this in any way.

tm

Overtime.TimeMeasure private

Defined in src\overtime.js:159

The currently set time measure.

TWO_PI

Number private final

Defined in src\overtime.js:26

PI * 2.

Events

update

Defined in src\overtime.js:150

Returns the remaining time.

Event Payload:

  • time Number
    • The remaining time.