Skip to content

火焰粒子

该框架支持火焰粒子动画效果

支持说明

INFO

支持多种火焰形状

box:盒装火焰

cone:锥形火焰

sphere:球形火焰

circle:圆形火焰

代码实例

typescript
<script setup lang="ts">
import { onMounted, onBeforeUnmount } from 'vue'
const LarkExplorer = window.LarkExplorer
let map: any
onMounted(() => {
  LarkExplorer.ready({
    baseUrl: './dist/resources/',
  }).then(initMap)
})

function initMap() {
  // 默认谷歌影像地图
  const baseImagery = LarkExplorer.BaseLayer.DefaultTdtImg
  // 默认全球地形
  const baseTerrain = LarkExplorer.BaseLayer.DefaultTerrain
  map = new LarkExplorer.Map('map', baseImagery, baseTerrain)
  window.Viewer = map
}
/**
 * 创建火焰粒子
 * @param type box-盒状,cone-锥形,sphere-球形,circle-圆形
 */
const fire = async (type: string) => {
  const terrain = map.Terrain.provider
  const x = 109 + Math.random() * 10
  const y = 25 + Math.random() * 10
  const pos = await LarkExplorer.Coordinate.PosOnTerrainFromDegree(terrain, [
    x,
    y,
  ])
  const fire = map.Layers.Particle.newFire(pos, type)
  map.Navigation.flyToItem(fire)
}
const removeAll = () => {
  map.Layers.Particle.removeAll()
}
</script>

运行效果 更多示例