On this page

Function getKeyframes

  • Generates an array of keyframes from coordinates, deltas, easings, and other properties provided by the geoJSON feature. Assumes that the coordinates are in the format [longitude, latitude, altitude?]. If altitude is not provided, it defaults to 0.

    Parameters

    • coordinates: number[][]

      Array of coordinate points, where each point is an array of [longitude, latitude, altitude?]

    • deltas: number[]

      Array of time deltas between keyframes

    • easings: EasingFunctionName[]

      Array of easing function names to apply to each keyframe transition

    • properties: Record<string, number[]> = {}

      Optional additional properties as key-value pairs, where each value is an array of numbers corresponding to each keyframe

    Returns Keyframe[]

    An array of Keyframe objects, each containing coordinate props, delta, and easing information

    Error if the arrays for coordinates, deltas, easings, and any property values don't have matching lengths

    const keyframes = getKeyframes(
      [[0, 0, 10], [10, 10, 20]], // coordinates
      [1000, 2000], // deltas (in milliseconds)
      ["Linear", "ElasticIn"], // easings
      { zoom: [10, 15] } // additional properties
    );
    
Was this helpful?
SDK JS
Reference
getKeyframes