MapboxDiffusionCircle

View source
扩散圆效果,多圈同心圆周期性扩张并渐隐。

简介

MapboxDiffusionCircle 在点要素上渲染扩散圆:多圈同心圆周期性向外扩张并渐隐;color / maxRadius / duration / rings / opacity 控制外观与节奏。

用法

切换主色查看扩散动画:

<script setup lang="ts">
import type { FeatureCollection } from 'geojson'

withDefaults(defineProps<{ color?: string }>(), {
  color: '#3b82f6'
})

const data: FeatureCollection = {
  type: 'FeatureCollection',
  features: [
    {
      type: 'Feature',
      properties: {},
      geometry: { type: 'Point', coordinates: [116.397, 39.908] }
    },
    { type: 'Feature', properties: {}, geometry: { type: 'Point', coordinates: [116.46, 39.92] } }
  ]
}
</script>

<template>
  <div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
    <MapboxMap
      :options="{ style: 'mapbox://styles/mapbox/dark-v11', center: [116.43, 39.913], zoom: 11 }"
    >
      <MapboxDiffusionCircle :data="data" :color="color" />
    </MapboxMap>
  </div>
</template>

API

Props

Prop Default Type
datastring | GeoJSON.Point | GeoJSON.MultiPoint | GeoJSON.LineString | GeoJSON.MultiLineString | GeoJSON.Polygon | GeoJSON.MultiPolygon | GeoJSON.GeometryCollection<GeoJSON.Geometry> | GeoJSON.Feature<GeoJSON.Geometry, { [name: string]: any; }> | GeoJSON.FeatureCollection<GeoJSON.Geometry, { [name: string]: any; }>

点要素数据(GeoJSON 或其 URL)

layerIdstring

图层 id 前缀;省略时自动生成

color'#3b82f6'string

主色

maxRadius40number

最大扩散半径(像素)

duration2400number

单圈扩散周期(毫秒)

rings3number

同时扩散的圈数

opacity0.6number

峰值不透明度

beforeIdstring

插入到该图层之前

Changelog

No recent changes
Copyright © 2026 - 2026 YiXuan - MIT License