Initializes a new animation instance with the provided configuration.
Returns the current time offset from the beginning of the animation in milliseconds.
Returns the current time of the animation's position in milliseconds.
Total time in seconds for the animation to complete. The animation speed will be determined by the duration and total intervals, so a longer duration will result in a slower animation speed for the same number of intervals.
Total time in seconds for the animation to complete. The animation speed will be determined by the duration and total intervals, so a longer duration will result in a slower animation speed for the same number of intervals.
Delay duration in seconds to hold the last interval of the animation before restarting from the beginning.
Delay duration in seconds to hold the last interval of the animation before restarting from the beginning.
Starting Epoch timestamp in milliseconds.
Starting Epoch timestamp in milliseconds.
The key associated with the animation, if any.
Current time value that represents now. This value is used to determine past/future time periods within the full time range.
Current time value that represents now. This value is used to determine past/future time periods within the full time range.
The animation's current position in the range of 0
to 1.0
, where 0
is the beginning
and 1.0
is the end.
The animation's current position in the range of 0
to 1.0
, where 0
is the beginning
and 1.0
is the end.
Ending Epoch timestamp in milliseconds.
Ending Epoch timestamp in milliseconds.
Returns the total time, in milliseconds, of the animation based on the start and end timestamps.
Returns whether the animation should be shown regardless of time.
Returns whether or not the animation can animation.
This method will return false
if the animation's from
and to
values are the same, or
if the animation is disabled.
Returns whether the animation should be visible for the specified time.
This method will return false
if the animation is specified as a future animation and the
time
is in the past, or if the animation is not specified as a future animation and the
time
is in the future.
Returns whether the animation's time range extends into the future.
Returns whether the animation's time range extends into the past.
Returns the current time interval as a Date
.
Returns the current time interval in milliseconds.
Sets whether the animation should be enabled.
Returns the end date of the animation.
Returns the current end offset relative to now, in milliseconds.
Called when an animation is first created, stopped or reset and determines the time interval to display for the static position so that it's closest to the current time as possible.
Advances the animation to the specified time.
The time in milliseconds to update the animation's playhead
to, which must be within the to
and from
time range.
Returns whether the listeners are registered for the specified event name.
Returns whether the animation is currently running.
Returns whether the animation should automatically begin playback after being created.
Returns whether the animation is currently enabled. Disabled animations would not animate during playback.
Returns whether the animation has been specified as a future-only animation, meaning it's only valid for time intervals into the future.
Returns whether the animation is currently loading data or assets required for playback.
Returns whether the animation is currently paused.
Returns whether the animation is ready for playback.
Subclasses may override this value to indicate additional data or assets are required to be loaded in order to begin playback.
Returns an array of timestamps defining the interval steps that will be rendered during playback.
Total intervals returned will be evenly distributed across the animations time range based
on the value for opts.intervals
.
Removes a registered listener function for the specified event.
Name of the event to remove the listener for.
Handler function to remove so it won't be executed next time the event is triggered.
Registers a listener function to be executed each time an event occurs
Name of the event to listen for. Value can contain multiple event names separated by spaces to trigger the same handler function for each event name.
Handler function to be called when the event occurs
Registers a listener function to be executed the first time an event occurs.
Name of the event to listen for. Value can contain multiple event names separated by spaces to trigger the same handler function for each event name.
Handler function to be called when the event occurs
Sets or returns the configuration value for the specified key path.
Pauses the animation at the current position.
To resume playback from a paused animation's current position, use resume()
.
Begins playing the animation if not currently running.
Updates the animation's start and end times based on the configured offsets and the current time and date.
Resets the animation to its original state.
Restarts the animation from the beginning.
Resumes playing the animation from the paused position.
Sets the end date of the animation.
Either a Date
instance or epoch time in milliseconds to update
the end time to
Sets the end date of the animation based on the specified offset relative to now, in milliseconds.
Sets the start date of the animation.
Either a Date
instance or epoch time in milliseconds to
update the start time to
Sets the start date of the animation based on the specified offset relative to now, in milliseconds.
Returns the start date of the animation.
Returns the current start offset relative to now, in milliseconds.
Stops playing the animation if currently running.
Starting the animation again using start()
after calling stop()
will restart the
animation from the beginning.
Either plays or stops the animation playback depending on the current state.
Triggers the specified event so that all registered listeners will be executed with the specified parameters.
Event name to trigger
Generated using TypeDoc
An
Animation
object provides the core functionality necessary for a single time-based animation. The animation is defined by a specified start and end date.