效果
实现思路
通过CallbackProperty类实现
关键代码
this.markerEntity.point = {
color: new Cesium.CallbackProperty(() => {
return a ? (markerOpacity -= .03,
markerOpacity <= 0 && (a = false)) : (markerOpacity = 1,
a = true),
this.color.withAlpha(markerOpacity)
}, false),
pixelSize: new Cesium.CallbackProperty((time, result) => {
return n ? (pixelSize += 2,
pixelSize >= pixelMax && (n = false)) : (pixelSize = 10,
n = true),
pixelSize
}, false),
outlineColor: new Cesium.CallbackProperty(() => {
return o ? (outLineOpacity -= .035,
outLineOpacity <= 0 && (o = false)) : (outLineOpacity = .7,
o = true),
this.color.withAlpha(outLineOpacity)
}, false),
outlineWidth: this.outWidth,
scaleByDistance: new Cesium.NearFarScalar(1200, 1, 5200, 0.4),
}
详情参见 Cesium实战项目