美文网首页
arcgis js 4 使用pixi.js滤镜构建一个发光圆

arcgis js 4 使用pixi.js滤镜构建一个发光圆

作者: haibalai | 来源:发表于2022-02-27 12:38 被阅读0次

这次我们用pixi.js 做一个发光扩散圆和arcgis js结合

我们先定义一下 传入数据结构

let option = {

renderer: {

type: "simple",

symbol: {

color: "#ffda1a",

radius: 12,

width: 2,

}

},

data: [

{

geometry: [12956152.73135875, 4855356.473704897],

attributes: {

name: "北京"

}

},

{

geometry: [12697872.012783196, 2577456.5937789795],

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 滤镜库

```javascript

//添加发光滤镜

let glow_filter = new GlowFilter(10, 2, 6, g_color, 0.5);

 更多参考 https://xiaozhuanlan.com/topic/7256014839

相关文章

网友评论

      本文标题:arcgis js 4 使用pixi.js滤镜构建一个发光圆

      本文链接:https://www.haomeiwen.com/subject/aorhrrtx.html