1 版本
cesium 1.92.0
2 实现原理
2.1 水面材质
选择一个水面波纹的短视频纹理,作为水面的材质:
videoMaterial: function (url) {
// "data/other/water.mp4"
let video = document.createElement('video');
video.src = url;
video.autoplay = true;
video.loop = true;
let material = new Cesium.ImageMaterialProperty({
image: video,
repeat: new Cesium.Cartesian2(5.0, 5.0),
transparent: true,
color: Cesium.Color.WHITE.withAlpha(0.5)
});
return material;
}
2.2 水深的涨跌原理
水深的动态涨跌主要是利用了Cesium的Property机制。Property最大的特点是和时间相互关联,在不同的时间可以动态地返回不同的属性值,而Entity则可以感知这些Property的变化,在不同的时间驱动物体进行动态展示。