PolygonMorpher

@naivemap/mapbox-gl-polygon-morpher在新页面打开 实现多边形平滑变化效果。

# yarn
yarn add @naivemap/mapbox-gl-polygon-morpher
# 或 npm
npm i @naivemap/mapbox-gl-polygon-morpher
import PolygonMorpher from '@naivemap/mapbox-gl-polygon-morpher'

// 1. 构造一个 PolygonMorpher
const geojsonSource = map.getSource('geojson-source') // 只需要一个 GeoJSON 数据源
const polygonMorpher = new PolygonMorpher(geojsonSource)

// 2. 变化到新的多边形
const newPolygonFeature = { type: 'Feature', geometry: { type: 'Polygon', coordinates: [] } }
polygonMorpher.morph(newPolygonFeature)