Fork me on GitHub
Show:

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:

Methods

add

Syntax

add

(
  • animations_or_layers
)

Summary

Add one or more animations to the sync.

Parameters:

addOne_

Syntax

addOne_

(
  • animation
)
private

Summary

Add a single animation to sync.

Parameters:

getCurrentTime

Syntax

getCurrentTime

() ?Date

Summary

Returns:

?Date:

getFrom

Syntax

getFrom

() Date

Summary

Returns:

Date:

getLoadProgress

Syntax

getLoadProgress

() Number

Summary

Get the total loading progress of animations within the animation sync. Only considers animations which are set to the map.

Returns:

getNextTime_

Syntax

getNextTime_

(
  • baseTime
  • timestep
)
Number private

Summary

Parameters:

  • baseTime Number
  • timestep Number

    Milliseconds to advance past base time.

Returns:

Number:

Next available time. If time is greater than 'to' bound, starts over at 'from'.

getPrevTime_

Syntax

getPrevTime_

(
  • baseTime
  • timestep
)
Number private

Summary

Parameters:

  • baseTime Number
  • timestep Number

    Milliseconds to reverse before base time.

Returns:

Number:

Next available time. If time is less than 'from' bound, starts over at 'to'.

getTimes

Syntax

getTimes

() Array.<number>

Summary

Returns:

Array.<number>:

UNIX timestamps. Sorted list of availble animation times.

getTo

Syntax

getTo

()

Summary

goToTime

Syntax

goToTime

()

Summary

hasMap

Syntax

hasMap

() Boolean

Summary

Is the animated object set to a map?

Returns:

isAnimating

Syntax

isAnimating

() Boolean

Summary

Returns:

Boolean:

True, if the animation is currently running.

keepCurrentTimeInBounds_

Syntax

keepCurrentTimeInBounds_

() private

Summary

Makes sure that the current time is always within the from and to bounds of the animation.

next

Syntax

next

(
  • opt_timestep
)

Summary

Parameters:

  • opt_timestep Number=

    Milliseconds to advance.

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:

removeOne_

Syntax

removeOne_

(
  • animation
)
private

Summary

Stop syncing a single animation.

Parameters:

setFrom

Syntax

setFrom

(
  • from
)

Summary

Parameters:

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:

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 Number

    Timestep, in milliseconds.

setTo

Syntax

setTo

(
  • to
)

Summary

Parameters:

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

animationClock_

Number private

Summary

A reference to the timer created by window.setInterval

animations_

Syntax

animations_

Array.> { 'layerCid': animation }. private

Summary

LayerAnimation instance.

animationsWhichHaveLoadedTimes_

Syntax

animationsWhichHaveLoadedTimes_

Array. private

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.

from_

Syntax

from_

Date protected

Summary

Animation start time.

limit_

Syntax

limit_

Number protected

Summary

Max number of time "frames" to load and render.

options_

Syntax

options_

Object private

Summary

Reference to the original options passed to the AnimationSync constructor.

speed_

Syntax

speed_

Number private

Summary

Number of minutes of weather data to display within a second.

timestep_

Syntax

timestep_

Number private

Summary

Milliseconds between animation frames.

to_

Syntax

to_

Date protected

Summary

Animation end time.

Default: Current time.

Events

autoUpdate

Syntax

autoUpdate

Summary

change:from

Syntax

change:from

Summary

Event Payload:

change:time

Syntax

change:time

Summary

When current time of the animation changes.

Event Payload:

change:to

Syntax

change:to

Summary

Event Payload:

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:error

Syntax

load:error

Summary

Event Payload:

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 Number

    complete (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.