MapboxGlowCircle
炫光圆效果,实心内核加模糊光晕,可选呼吸脉冲。
简介
MapboxGlowCircle 在点要素上渲染炫光圆:实心内核 + 模糊光晕,pulse 开启呼吸脉冲;color / radius / glowScale / duration 控制外观与节奏。
用法
切换主色查看带呼吸脉冲的炫光:
<script setup lang="ts">
import type { FeatureCollection } from 'geojson'
withDefaults(defineProps<{ color?: string }>(), {
color: '#f59e0b'
})
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 }"
>
<MapboxGlowCircle :data="data" :color="color" pulse />
</MapboxMap>
</div>
</template>
API
Props
| Prop | Default | Type |
|---|---|---|
data | string | 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) | |
layerId | string图层 id 前缀;省略时自动生成 | |
color | '#f59e0b' | string主色 |
radius | 6 | number内核半径(像素) |
glowScale | 3 | number光晕半径倍数 |
duration | 2000 | number脉冲周期(毫秒) |
beforeId | string插入到该图层之前 | |
pulse | false | boolean呼吸脉冲(光晕半径 ±25% 正弦摆动) |
Changelog
No recent changes