这次我们用pixi.js 做缩放圆和arcgis js结合
我们先定义一下 传入数据结构
let option = {
renderer: {
type: "simple",
symbol: {
color: "#FF3366",
radius: 20,
width: 4,
}
},
data: [
{
geometry: [11581249.298924139, 3596576.264215719],
attributes: {
name: "成都"
}
},
{
geometry: [9747738.924467796, 5447697.909138256],
attributes: {
name: "乌鲁木齐"
}
}
]
};
对于缩放动画 我们使用gsap 来建立
import {TimelineMax, TweenLite} from "gsap/gsap-core";
对于symbol 里面的color转换 我们写一个方法转成pixi的color 范式
function getColor(str: string, alpha = 1){
if (alpha > 1 || alpha < 0) {
return "透明度 Error value!";
}
//如果传入常规的颜色值,去除#
str = str.toString();
if (str.startsWith('#')) {
str = str.replace('#', '');
}
alpha = 255 * alpha;
// @ts-ignore
alpha = alpha.toString(16);
str = alpha + str;
alpha = parseInt(str, 16);
return alpha;
}
对于圆形带有模糊效果 我们使用pixi.js 滤镜库
//添加模糊滤镜
let bloomFilter = new PIXI.filters.BlurFilter(6, 8);
sprite.filters = [bloomFilter]
更多参考 https://xiaozhuanlan.com/topic/6129380475
版权声明:本文为haibalai2009原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。