AnimationSync
Summary
Animates multiple layers along a single timeline. Works by running a single 'master' animation, and having all other animations go to the same time as the master.
The master animation is dynamically set as the animation with the shortest average interval between time frames. You can manually set the master animation using the setMaster method, as well.
Constructor
aeris.maps.animations.AnimationSync
Syntax
aeris.maps.animations.AnimationSync
-
opt_animations
-
opt_options.AnimationType_
Summary
Parameters:
-
opt_animations
Array<AnimationLayer|AnimationInterface>=Layers/Animations to sync. Animations can also be added using the
add
method. -
opt_options.AnimationType_
function():AnimationInterfaceThe type (constructor) of animation object to create when adding a layer to the AnimationSync.
Item Index
Methods
Properties
Methods
add
Syntax
add
-
animations_or_layers
Summary
Add one or more animations to the sync.
Parameters:
-
animations_or_layers
Array.<AnimationInterface|AnimationLayer>Animation object or layer (or an array of objects).
addOne_
Syntax
addOne_
-
animation
Summary
Add a single animation to sync.
Parameters:
-
animation
AnimationInterface
getLoadProgress
Syntax
Summary
Get the total loading progress of animations within the animation sync. Only considers animations which are set to the map.
Returns:
getNextTime_
Syntax
Summary
Returns:
Next available time. If time is greater than 'to' bound, starts over at 'from'.
getPrevTime_
Syntax
Summary
Returns:
Next available time. If time is less than 'from' bound, starts over at 'to'.
getTimes
Syntax
Summary
getTo
Syntax
getTo
()
Summary
goToTime
Syntax
goToTime
()
Summary
keepCurrentTimeInBounds_
Syntax
keepCurrentTimeInBounds_
()
private
Summary
Makes sure that the current time is always within
the from
and to
bounds of the animation.
normalizeTimeBounds_
Syntax
normalizeTimeBounds_
()
private
Summary
pause
Syntax
pause
()
Summary
Stop animation the layer, and stay at the current frame.
preload
Syntax
preload
()
Summary
previous
Syntax
previous
-
opt_timestep
Summary
Parameters:
-
opt_timestep
Number=Milleseconds to rewind.
remove
Syntax
remove
-
animations
Summary
Stop syncing one or more animations
Parameters:
-
animations
AnimationInterface|Array.<AnimationInterface>
removeOne_
Syntax
removeOne_
-
animation
Summary
Stop syncing a single animation.
Parameters:
-
animation
AnimationInterface
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
triggerLoadProgress_
Syntax
triggerLoadProgress_
()
private
Summary
Recalculates the total load progress of all animations.
Fires 'load:complete' and 'load:progress' events
Properties
animationClock_
Syntax
Summary
A reference to the timer created by window.setInterval
animations_
Syntax
animations_
Array.Summary
LayerAnimation instance.
animationsWhichHaveLoadedTimes_
Syntax
animationsWhichHaveLoadedTimes_
Array.Summary
Memory of which animations have triggered a load:times event.
AnimationType_
Syntax
AnimationType_
function():aeris.maps.animations.AnimationInterface
private
Summary
Type of animation object to use when adding a layer.
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.
options_
Syntax
Summary
Reference to the original options passed to the AnimationSync constructor.
speed_
Syntax
Summary
Number of minutes of weather data to display within a second.
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.