arcgis 4 构建插值线性动画 (二)

调用

let lineSymbol2 = {
type: “simple-line”,
color: “#ffffff”,
width: “2”,
style: “solid”
},
let lineSymbol = {
type: “simple-line”,
color: “#1cccdf”,
width: “3”,
style: “solid”
},
let paths = [
[
[12709310.232279215, 2544308.84766577],
[12691271.093603922, 2593840.0419945405],
[12662836.51908185, 2633893.0448159534]
]
]
let myMapId = {
layerName: “gralyer1”,
mapId: this.view,
dynamicLine: lineSymbol,
staticLine: lineSymbol2,
isInsert: true,
isBaseLine: true,
isClear: false
};
this.myLine = new PathAnimation(myMapId);
this.myLine.setData(paths);
this.myLine.setSpeed(5);
this.myLine.open();
线性动画主类


import realTimeTrance from './realTimeTrance';

/**

线动画
@param options[]
**/
export class PathAnimation {
constructor(options) {
this.options = {
layerName: 'gralyer',
view: null,
time: 100,
isInsert: null, //是否进行插值算法
isBaseLine: null, //是否需要加基线
dynamicLine: {
//动线样式
type: 'simple-line',
color: [0, 0, 0, 1],
width: '1',
style: 'solid'
},
staticLine: {
//基线样式
type: 'simple-line',
color: '#F44336',
width: '2',
style: 'solid'
},
isClear: null
};
this.initialize(options);
}

initialize(options) {
this.setOptions(this, options);
this._view = this.options.view;
this.time = this.options.time;
this.linePoints = null;
this.isOpen = false;
this.speed = 2;
this.createTrance();
this.index = 0;
}

//初始化将传入参数赋值
setOptions(obj, options) {
for (const i in options) {
obj.options[i] = options[i];
}
return obj.options;
}

setLineSymbol(symbol) {
this.realTimeTrance.setLineSymbol(symbol);
}

//初始化线
createTrance() {
const self = this;
const option = {
view: self._view,
lineSymbol: self.options.dynamicLine,
layerName: self.options.layerName
};
self.realTimeTrance = new realTimeTrance(option);
}

//设置点数据
setData(lineData) {
this.lineData = lineData;
if (this.options.isInsert) {
this.linePoints = this.getNewData(lineData);
} else {
this.linePoints = lineData[0];
}
return this.linePoints;
}

 更多参考 https://xiaozhuanlan.com/topic/0173492568
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值