Cesium在三維上的實力我們都見識過了。。但是在時間上的效果要歸功於CallbackProperty
因為使用CallbackProperty,cesium中一切可視化的要素都可以與時間聯系起來。
一、定義CallbackProperty函數
new Cesium.CallbackProperty(getEndPoint, isConstant)
function getEndPoint (time, result) {
endLongitude = startLongitude - 0.001 * Cesium.JulianDate.secondsDifference(time, startTime);
return Cesium.Cartesian3.fromDegreesArray(
[startLongitude, startLatitude, endLongitude, startLatitude],
Cesium.Ellipsoid.WGS84,
result
);
}
二、CallbackProperty應用實例
下面的代碼實例就是利用CallbackProperty函數獲不斷更新線段的終點,並在線段中點位置顯示線段的長度。
參考1:https://blog.csdn.net/luoyun620/article/details/107182493/
CallbackProperty或許類似於vue里的watch,CallbackProperty監聽:當變量變化時觸發該監聽,通過監聽鼠標拾取坐標的變化實現動態繪制。
參考2:https://blog.csdn.net/weixin_30849591/article/details/95639788
使用Cesium.CallbackProperty可以實時更改Geometry.position等參數,從而達到繪制的效果。
