cesium平滑运动
时间: 2023-10-14 16:08:05 浏览: 62
Cesium中平滑运动可以通过使用Cesium的SampledPositionProperty类来实现。该类可以在指定的时间间隔内对实体进行平滑的移动,从而创建出流畅的动画效果。
示例代码如下:
```javascript
var entity = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
model: {
uri: 'path/to/model.gltf'
}
});
var property = new Cesium.SampledPositionProperty();
property.addSample(Cesium.JulianDate.now(), entity.position.clone());
viewer.clock.onTick.addEventListener(function(clock) {
var time = clock.currentTime;
var position = property.getValue(time);
if (Cesium.defined(position)) {
entity.position.setValue(position);
}
});
property.addSample(Cesium.JulianDate.addSeconds(Cesium.JulianDate.now(), 5, new Cesium.JulianDate()), Cesium.Cartesian3.fromDegrees(-75.59977, 40.03883));
```
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)