失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > Cesium 设置实体要素闪烁

Cesium 设置实体要素闪烁

时间:2021-07-05 16:40:22

相关推荐

Cesium 设置实体要素闪烁

设置要素闪烁:

//id-要素实体id,second-闪烁时间SetEntityFlicker(id, second) {let entity = viewer.entities.getById(id);if (!entity) return;let x = 1;let flog = true;let fs = [];let callback = new Cesium.CallbackProperty(() => {if (flog) {x = x - 0.02;if (x <= 0) {flog = false;}} else {x = x + 0.02;if (x >= 1) {flog = true;}}return x >= 0.5;}, false);if (entity.billboard) {entity.billboard.show = callback;fs.push(entity.billboard);}if (entity.box) {entity.box.show = callback;fs.push(entity.box);}if (entity.corridor) {entity.corridor.show = callback;fs.push(entity.corridor);}if (entity.cylinder) {entity.cylinder.show = callback;fs.push(entity.cylinder);}if (entity.ellipse) {entity.ellipse.show = callback;fs.push(entity.ellipse);}if (entity.ellipsoid) {entity.ellipsoid.show = callback;fs.push(entity.ellipsoid);}if (entity.label) {entity.label.show = callback;fs.push(entity.label);}if (entity.model) {entity.model.show = callback;fs.push(entity.model);}if (entity.path) {entity.path.show = callback;fs.push(entity.path);}if (entity.plane) {entity.plane.show = callback;fs.push(entity.plane);}if (entity.point) {entity.point.show = callback;fs.push(entity.point);}if (entity.polygon) {entity.polygon.show = callback;fs.push(entity.polygon);}if (entity.polyline) {entity.polyline.show = callback;fs.push(entity.polyline);}if (entity.polylineVolume) {entity.polylineVolume.show = callback;fs.push(entity.polylineVolume);}if (entity.rectangle) {entity.rectangle.show = callback;fs.push(entity.rectangle);}if (entity.wall) {entity.wall.show = callback;fs.push(entity.wall);}setTimeout(function () {fs.forEach((f) => {f.show = true;});}, second * 1000);}

设置要素停止闪烁:

SetEntityStopFlicker(id) {let entity = viewer.entities.getById(id);if (!entity) return;if (entity.billboard) {entity.billboard.show = true;}if (entity.box) {entity.box.show = true;}if (entity.corridor) {entity.corridor.show = true;}if (entity.cylinder) {entity.cylinder.show = true;}if (entity.ellipse) {entity.ellipse.show = true;}if (entity.ellipsoid) {entity.ellipsoid.show = true;}if (entity.label) {entity.label.show = true;}if (entity.model) {entity.model.show = true;}if (entity.path) {entity.path.show = true;}if (entity.plane) {entity.plane.show = true;}if (entity.point) {entity.point.show = true;}if (entity.polygon) {entity.polygon.show = true;}if (entity.polyline) {entity.polyline.show = true;}if (entity.polylineVolume) {entity.polylineVolume.show = true;}if (entity.rectangle) {entity.rectangle.show = true;}if (entity.wall) {entity.wall.show = true;}}

如果觉得《Cesium 设置实体要素闪烁》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。