TomTom Maps for JavaScript
    Preparing search index...

    Class RouteFlyover

    A camera that flies a route, on a loop or once to the destination. Every frame, it advances a distance along the line, reads the route's coordinate at that distance, and points itself at where it will be next.

    The route is the only geometry it needs. There's no path of camera keyframes to author and no animation to re-time when the route changes. What it adds on top of following the line:

    • It aims ahead rather than at its own position, by distance, by route vertices or at the next guidance instruction, so the view turns into a bend before the camera reaches it.
    • It frames what is coming, with the zoom that fits the next junctions or one tied to the speed.
    • It clears the ground, pulling back where terrain would come between the camera and the road.
    • It parks the position where you want it on screen (see FlyoverAnchor), and marks it with an arrow, or an image of your own, facing the road.
    • It moves like a camera. Every value it changes eases on a critically damped spring, so a new heading, zoom or setting bends the motion rather than kicking it, and a start ramps the speed.

    While it runs, the flight owns the altitude of the point the camera looks at, which is the ground under the followed position. It therefore turns off MapLibre's clamping of the centre to the ground, and restores it when it stops.

    import { RouteFlyover } from '@tomtom-org/maps-sdk-plugin-flyover';

    const [route] = (await calculateRoute({ locations, guidance: { type: 'coded' } })).features;
    const flyover = new RouteFlyover(map, { route, camera: { speedKMH: 300, pitch: 76 } });
    flyover.start();
    Index
    • get running(): boolean

      Whether the flight is advancing.

      Returns boolean

    • Stops the flight and gives the map back. The marker leaves, and the padding returns to what the map had before the flight first placed the camera.

      Returns void

    • Moves the flight to a point along the route: a share of its length within 0..1, or a time or distance travelled, or a clock time, the way getCoordinateAtRouteProgress reads them. A point outside the route moves it to the nearer end, and a clock time on a route without a departure time to the departure.

      Parameters

      Returns void

    • Applies camera settings (speed, pitch, aim, framing, anchor), whether paused or under way.

      Parameters

      Returns void

    • Puts a new route under the flight, from its departure point.

      Parameters

      Returns void

    • Starts, or resumes, the flight, ramping up to its speed. A flight that doesn't loop and has arrived starts again from the departure.

      Returns void

    • Stops the flight where it is. start resumes from there. The centre clamp returns to what the map had before start.

      Returns void