这次我们用pixi.js和arcgis js结合
我们先定义一下 传入数据结构 symbol 暂时不做
let option = {
renderer: {
type: “simple”,
symbol: {
}
},
data: [
{
geometry: [12956152.73135875, 4855356.473704897],
attributes: {
name: “北京”
}
},
{
geometry: [12697872.012783196, 2577456.5937789795],
attributes: {
name: “深圳”
}
}
]
};
对于data 数据 ,
toScreen 方法参考链接提示
app 的构建参考 链接提示
let data = this.options.data;
for(let item of data){
//转换屏幕坐标,获取颜色,半径和线条粗细样式
let geo = item.geometry
let XY1 = toScreen(geo);
const segments = 32; // 预定义的圆形段数
const radius = 100; // 半径
const positions = [];
const uvs = [];
const indices = [];
// 创建顶点数据
for (let i = 0; i < segments; i++) {
const angle = i / segments * Math.PI * 2;
positions.push(Math.cos(angle) * radius, Math.sin(angle) * radius);
uvs.push(0.5 + Math.cos(angle) * 0.5, 0.5 + Math.sin(angle) * 0.5);
}
// 创建索引数据
for (let i = 0; i < segments - 2; i++) {
indices.push(0, i + 1, i + 2);
}
const geometry = new PIXI.Geometry()
.addAttribute(‘position’, positions, 2)
.addAttribute(‘uv’, uvs, 2)
.addIndex(indices);
const fragmentShader = `
#ifdef GL_ES
precision highp float;
#endif
uniform float time;
vec2 resolution = vec2(1.0,1.0);
varying vec2 vUv;
#define NUM_PARTICLES 50.
#define iTime time
Arcgis 与 Pixi.js 可视化 glsl 特效篇(三十六) - 小专栏