Customizing the Route Animation
Last updated
Was this helpful?
Was this helpful?
// Assuming 'mapsIndoors' and 'stopIconProvider' are defined as needed
// 1. Initialize the DirectionsRenderer (as described on the main page)
const directionsRenderer = new mapsindoors.directions.DirectionsRenderer({
mapsIndoors: mapsindoors,
fitBoundsPadding: 200,
defaultRouteStopIconProvider: stopIconProvider,
});
// 2. Get the route animation controller
const routeAnimation = directionsRenderer.getAnimation();
// 3. Set desired animation options
routeAnimation.setOptions({
strokeColor: '#E41E26', // A distinct red color
strokeWeight: 6, // Make the line noticeably thicker
speed: 450 // Increase the animation speed
});
// 4. Later, when you render a route...
// directionsRenderer.setRoute(myRoute);
// ...the animation will use the custom settings defined above.