---
title: "MapboxLottieMarker"
description: "在标记位用 lottie-web 渲染矢量动画，支持 animationData 内联或 path 远程加载。"
seo_title: "MapboxLottieMarker Component"
seo_description: "MapboxLottieMarker renders a Lottie vector animation at a marker position via lottie-web, accepting inline animationData or a remote path."
canonical_url: "https://mapbox.mhaibaraai.cn/docs/core/lottie-marker"
---
# MapboxLottieMarker

> 在标记位用 lottie-web 渲染矢量动画，支持 animationData 内联或 path 远程加载。

## 简介

`MapboxLottieMarker` 在标记位置用 lottie-web 渲染矢量动画（基于 [MapboxMarker](/docs/core/marker) 的 DOM，而非 icon 帧驱动）。动画来源 `animationData`（内联 JSON）或 `path`（远程 URL）二选一，位置经 `v-model:lnglat` 绑定。

## 用法

传入内联 `animationData`，`width` / `height` 控制尺寸：

```vue [LottieMarkerExample.vue]
<script setup lang="ts">
import type { LngLatLike } from 'mapbox-gl'
import animationData from '~/assets/lottie/marker-pulse.json'

const position = ref<LngLatLike>([116.397, 39.908])
</script>

<template>
  <div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
    <MapboxMap :options="{ style: 'mapbox://styles/mapbox/light-v11', center: [116.397, 39.908], zoom: 12 }">
      <MapboxLottieMarker
        v-model:lnglat="position"
        :animation-data="animationData"
        :width="80"
        :height="80"
      />
    </MapboxMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MapboxLottieMarker component
 */
interface MapboxLottieMarkerProps {
  lnglat: mapboxgl.LngLatLike;
  /**
   * lottie 动画数据（JSON 对象）；与 path 二选一
   */
  animationData?: object | undefined;
  /**
   * lottie 动画 URL；与 animationData 二选一
   */
  path?: string | undefined;
  /**
   * 是否循环
   * @default "true"
   */
  loop?: boolean | undefined;
  /**
   * 是否自动播放
   * @default "true"
   */
  autoplay?: boolean | undefined;
  /**
   * 播放速度倍率
   * @default "1"
   */
  speed?: number | undefined;
  /**
   * 容器宽（像素）
   * @default "64"
   */
  width?: number | undefined;
  /**
   * 容器高（像素）
   * @default "64"
   */
  height?: number | undefined;
}
```

### Emits

```ts
/**
 * Emitted events for the MapboxLottieMarker component
 */
interface MapboxLottieMarkerEmits {
  update:lnglat: (payload: [value: mapboxgl.LngLatLike]) => void;
}
```

## Changelog

See commit history for [src/runtime/components/MapboxLottieMarker.vue](https://github.com/mhaibaraai/movk-mapbox/commits/main/src/runtime/components/MapboxLottieMarker.vue).


## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
