AutoUpdateAnimation
Summary
An AutoUpdateAnimation is automatically updated to to display the most current tiles available from the Aeris API.
The timespan (to - from) of an AutoUpdateAnimation object will always remain constant.
For example:
var animation = new AutoUpdateAnimation({ from: 1PM_TODAY to: 3PM_TODAY });
// Some time passes... // Tiles become available for 4PM_TODAY animation.getTo(); // 4PM_TODAY animation.getFrom(); // 2PM_TODAY
Note that as the animation range is updated, it will trigger 'change:from' and 'change:to' events. This is useful if you need UI components to reflect the range of the animation.
animation.on('change:from change:to', function() { $('#rangeInput').attr('min', animation.getFrom().getTime()); $('#rangeInput').attr('max', animation.getFrom().getTime()); });
Constructor
aeris.maps.animations.AutoUpdateAnimation
Syntax
aeris.maps.animations.AutoUpdateAnimation
()
Summary
Item Index
Methods
- bindToLayerAutoUpdate_
- destroy
- getClosestTime_
- getClosestTimeInSameTense_
- getCurrentTime
- getFrom
- getLayerForTimeInSameTense_
- getLayerIndex_
- getLoadProgress
- getTimes
- getTo
- goToTime
- hasMap
- isAnimating
- isCurrentLayer_
- isCurrentLayerFirst_
- isCurrentLayerLast_
- keepCurrentTimeInBounds_
- loadAnimationLayers
- next
- normalizeTimeBounds_
- pause
- preload
- preloadLayer_
- previous
- refreshCurrentLayer_
- setFrom
- setSpeed
- setTimestep
- setTo
- start
- stop
- syncLayerToMaster_
- transition_
- transitionIn_
- transitionInClosestLoadedLayer_
- transitionOut_
- transitionWhenLoaded_
Properties
Methods
bindToLayerAutoUpdate_
Syntax
bindToLayerAutoUpdate_
()
private
Summary
destroy
Syntax
destroy
()
Summary
Destroys the tile animation object, clears animation frames from memory.
getClosestTime_
Syntax
Summary
Returns the closes available time.
Parameters:
Returns:
getClosestTimeInSameTense_
Syntax
Summary
Returns the closes available time.
If provided time is in the past, will return the closest past time (and vice versa);
Parameters:
Returns:
getLayerIndex_
Syntax
Summary
Returns the index of the current layer within this.times_.
Returns:
getLoadProgress
Syntax
Summary
Returns:
Percentage complete loading tile (1.0 is 100% complete).
getTimes
Syntax
Summary
Returns available times. Note that times are loaded asynchronously from the Aeris Interactive Tiles API, so they will not be immediately available.
Wait for the 'load:times' event to fire before attempting to grab times.
getTo
Syntax
getTo
()
Summary
goToTime
Syntax
goToTime
-
time
Summary
Animates to the layer at the specified time.
If no layer exists at the exact time specified, will use the closest available time.
hasMap
Syntax
hasMap
()
Summary
isCurrentLayerFirst_
Syntax
Summary
Returns:
True, if the current layer is the first frame.
keepCurrentTimeInBounds_
Syntax
keepCurrentTimeInBounds_
()
private
Summary
Makes sure that the current time is always within
the from
and to
bounds of the animation.
loadAnimationLayers
Syntax
Summary
Load the tile layers for the animation.
Returns:
Promise to load all layers.
next
Syntax
next
()
Summary
Animates to the layer at the next available time, or loops back to the start.
normalizeTimeBounds_
Syntax
normalizeTimeBounds_
()
private
Summary
pause
Syntax
pause
()
Summary
Stop animation the layer, and stay at the current frame.
preload
Syntax
preload
()
Summary
preloadLayer_
Syntax
Summary
Preloads a single tile layer.
Parameters:
-
layer
AerisTile
Returns:
Promise to load the layer
previous
Syntax
previous
()
Summary
Animates to the previous layer, or loops back to the last layer.
refreshCurrentLayer_
Syntax
refreshCurrentLayer_
()
private
Summary
setSpeed
Syntax
setSpeed
-
speed
Summary
Set the animation speed.
Every second, [timestep] * [speed] milliseconds of tiles are animated.
So with a timestep of 360,000 (6 minutes), and a speed of 2: every second, 12 minutes of tiles will be animated.
Setting a negative speed will cause the animation to run in reverse.
Also see {aeris.maps.animations.AbstractAnimation}#setTimestamp
Parameters:
-
speed
Number
setTimestep
Syntax
setTimestep
-
timestep
Summary
Sets the animation timestep.
See {aeris.maps.animations.AbstractAnimation}#setSpeed for more information on how to use setTimestep and setSpeed to affect your animation speed.
Parameters:
-
timestep
NumberTimestep, in milliseconds.
start
Syntax
start
()
Summary
Start animating the layer.
Every second, the layer is animated up by timestep * speed milliseconds.
stop
Syntax
stop
()
Summary
Stop animating the layer, and return to the most recent frame
syncLayerToMaster_
Syntax
syncLayerToMaster_
-
layer
Summary
Update the attributes of the provided layer to match those of the master layer.
Parameters:
-
layer
AerisTile
transition_
Syntax
transition_
-
opt_oldLayer
-
newLayer
Summary
Transition from one layer to another.
transitionInClosestLoadedLayer_
Syntax
transitionInClosestLoadedLayer_
()
private
Summary
Properties
animationClock_
Syntax
Summary
A reference to the timer created by window.setInterval
currentLayer_
Syntax
currentLayer_
?aeris.maps.layers.AerisTile
private
Summary
currentTime_
Syntax
currentTime_
Number Timestamp
private
Summary
The time of the current animation frame.
endDelay_
Syntax
endDelay_
number Milliseconds.
private
Summary
Time to wait before repeating animation loop.
layersByTime_
Syntax
layersByTime_
Object.Summary
A hash of {aeris.maps.layers.AerisTile}, listed by timestamp.
masterLayer_
Syntax
Summary
The original layer object, which will serve as the 'master' for all animation layer "frames."
speed_
Syntax
Summary
Number of minutes of weather data to display within a second.
times_
Syntax
times_
Array.number
private
Summary
An array of available timestamps.
Events
autoUpdate
Syntax
autoUpdate
Summary
change:time
Syntax
change:time
Summary
When current time of the animation changes.
Event Payload:
-
time
Date
load:complete
Syntax
load:complete
Summary
Fires when all animation tile frames are loaded.
Waiting to start an animation until this event is triggered will ensure smooth animations.
If an animation is started before all tile frames are loaded, tiles which are not yet loaded will not render until they are loaded.
load:progress
Syntax
load:progress
Summary
Fires to indicate progress in preloading tiles.
Useful for rendering loading UI to the user, or if you want to buffer an animation to a certain % done.
Event Payload:
-
Percent
Numbercomplete (where 1.0 is 100%).
load:times
Syntax
load:times
Summary
Fires when tile times are loaded for this animation.
Event Payload:
-
A
Array.list of timestamps. for which animation frames will be created.