Class

VariableDuration

VariableDuration(from, toopt)

A variable duration is a timer that completes within some variable time range.

Constructor

# new VariableDuration(from, toopt)

Create and start the duration timer immediately.

Parameters:
Name Type Attributes Description
from Number

start of the duration range in seconds.

to Number <optional>

end of the duration range in seconds.

View Source util/variable-duration.js, line 6

Example
// Create a duration that will be somewhere between 10 and 20 seconds.
const duration = new VariableDuration(10, 20);

// ...

if (!duration.complete) {
  // ...
}

Members

# complete

True if this duration's target time has been reached.

View Source util/variable-duration.js, line 49

# percentage

Returns the percent complete of this duration.

View Source util/variable-duration.js, line 56