Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FollowPathAnimationController

Animation controller for following a path on the map. Interpolates position, altitude, and bearing along a given GeoJSON coordinate array Handles speed, auto-rotation, pitch, camera offset, and heading smoothing.

Example:

import {FollowPathAnimationController} from '@here/xyz-maps-display';

const path: GeoJSONCoordinate[] = [
  [13.405, 52.52], [13.406, 52.521], [13.407, 52.522]
];
const controller = new FollowPathAnimationController(mapDisplay, path, {
  duration: 10000, // 10 seconds
});
controller.start();

// In case you want to wait for the animation to complete:
await controller.complete();
console.log('Animation completed');

Hierarchy

Index

Constructors

constructor

  • new FollowPathAnimationController(display: any, coordinates: GeoJSONCoordinate[], options?: { altitude?: number; autoRotate?: boolean; duration?: number; headingSmoothing?: number; loop?: boolean; pitch?: number; speed?: number }): FollowPathAnimationController
  • Creates a new FollowPathAnimationController.

    Parameters

    • display: any

      The map display instance.

    • coordinates: GeoJSONCoordinate[]

      Array of GeoJSON coordinates representing the path.

    • Default value options: { altitude?: number; autoRotate?: boolean; duration?: number; headingSmoothing?: number; loop?: boolean; pitch?: number; speed?: number } = {}

      Optional Animation options

      • Optional altitude?: number

        Additional altitude in meters to add to the path (for camera elevation).

      • Optional autoRotate?: boolean

        If true, the camera automatically rotates to follow the path.

        defaultvalue

        true

      • Optional duration?: number

        duration of the animation in milliseconds. Ignored if speed is set.

      • Optional headingSmoothing?: number

        Controls how quickly the camera's heading (bearing) follows the path direction.

        Range: 0 to 1.

        • 0 — No smoothing. Camera instantly snaps to path bearing; turns appear abrupt.
        • 1 — Maximum smoothing. Camera rotates very slowly; turns appear smooth but delayed.
        • 0 < x < 1 — Partial smoothing. Higher values = slower, smoother rotation; lower values = faster, more responsive rotation.

        Recommended values are between 0.8 and 0.99 for a good balance of responsiveness and smoothness.

        defaultvalue

        0.95

      • Optional loop?: boolean

        Whether the animation should loop upon completion.

        defaultvalue

        false

      • Optional pitch?: number

        Camera pitch angle in degrees (0 = top-down, 90 = side view).

      • Optional speed?: number

        Animation speed in meters per second (m/s).

    Returns FollowPathAnimationController

Methods

cancel

  • cancel(): void

complete

  • complete(): Promise<void>

Protected frame

  • frame(now: number): void
  • Internal frame handler. Calls updateFrame(t) which should be implemented by subclasses.

    Parameters

    • now: number

    Returns void

isRunning

  • isRunning(): boolean

onComplete

  • onComplete(cb: () => void): void
  • Set a callback to be invoked when the animation completes.

    Parameters

    • cb: () => void
        • (): void
        • Returns void

    Returns void

pause

  • pause(): void

resume

  • resume(): void

start

  • start(): void

Protected updateFrame

  • updateFrame(t: number): void
  • Override this in subclasses to implement animation logic.

    Parameters

    • t: number

      normalized time [0..1] after easing

    Returns void

Generated using TypeDoc