gisthreemap
Version:
基于webGL的三维api
46 lines (43 loc) • 1.4 kB
JavaScript
import Effect from './Effect'
/**
* 线圈发光效果
* 包括发光材质scanlineMaterialProperty和类scanline.js
*/
// 线圈发光扩散效果
class Scanline extends Effect {
constructor(viewer, id) {
super(viewer, id)
}
change_duration(d) {
super.change_duration(d)
const curEntity = this.viewer.entities.getById(this.id)
curEntity._ellipse._material.speed = d
}
add(position, color, maxRadius, speed, isedit = false) {
super.add(position, color, maxRadius, speed, isedit)
const _this = this
this.viewer.entities.add({
// id: _this.id,
eid: _this.eid,
position: Cesium.Cartesian3.fromDegrees(
position[0],
position[1],
position[2]
),
ellipse: {
semiMinorAxis: new Cesium.CallbackProperty(function(n) {
return _this.maxRadius
}, false),
semiMajorAxis: new Cesium.CallbackProperty(function(n) {
return _this.maxRadius
}, false),
material: new Cesium.ScanlineMaterialProperty(
new Cesium.Color.fromCssColorString(color),
speed
),
classificationType: Cesium.ClassificationType.BOTH,
},
})
}
}
export default Scanline