new RouteAnimationManager()
An instance of RouteAnimationManager is automatically created when creating RouteManager.
It's properties and methods can be accessed through RouteManager's routeAnimationManager namespace.
RouteManager's animation related option handleUserInteractions determines whether or not user's interactions should stop
the animation. Animation related options animationSpeed and slowSpeedOnTurns determines how fast bluedot should travel during the animation.
Option showRoutePreview creates a preview animation for the route when it's added on setRoute().
The preview animation will first fit the map to route lines bounds and then fly to the beginning of route.
RouteAnimationManager internally manages the animation related time, distance and bearing values so that if animation stops
it will continue smoothly from where it left off once it starts again. The animation uses requestAnimationFrame()
so that during each frame time bluedot travels distance based on animationSpeed and frame rate.
Note that animating route is only possible if you have active building in the view.
Animation can be reset, stopped and started programmatically and RouteAnimationManager fires events based on it's animation state.
Properties:
Name | Type | Description |
---|---|---|
animationSpeed |
number | Speed with which animation will run. |
handleUserInteractions |
boolean | Boolean value which determines if user interactions should stop animation. |
isAnimating |
boolean | Boolean value to check whether or not map view is being animated. |
lineDistance |
number | Distance of the line currently being animated. |
isRouteAnimationFinished |
boolean | Boolean value to check whether or not route animation is finished. |
routePoints |
array | List of route point coordinates. |
showRoutePreview |
boolean | Boolean value which sets whether or not preview animation will happen |
travelledDistance |
number | Distance bluedot has travelled in current line. |
turnAnimationSpeed |
number | Animation speed during turns. |
Methods
(static) handleAnimation()
Function to use when you want to toggle the route animation to run or stop.
Very useful if you want to handle routes animation from one single button.
Example
routeManager.routeAnimationManager.handleAnimation()
(static) startAnimation()
Starts the route animation from where it left off before pause
Example
routeManager.routeAnimationManager.startAnimation()
(static) stopAnimation()
Stops the route animation
Example
routeManager.routeAnimationManager.stopAnimation()