startBounce() {
const image = require('./logo.png');
const height = 44;
const e = {
lng: 116.4,
lat: 39.14,
opts: {
image,
bounceHeight: 100,
increment: 5
}
};
let t = 0;
let s = 0;
// 跳动可上升的最大值
var addHei = 100;
// 步长
var inc = 0.05;
const i = height + addHei; // i = 1100
earth.czm.viewer.entities.add({
position: new Cesium.CallbackProperty(() => {
s = s + inc;
t = t + s;
// 当点位的高度到达峰值时开始下降
if (t > addHei) {
t = addHei;
s *= -1;
// 高度值减半
s *= 0.55;
}
return Cesium.Cartesian3.fromDegrees(116.39100974877458, 39.91160818097693, i - t);
}, false),
billboard: { image }
});
},
标签:const,CallbackProperty,image,跳动,entity,addHei,Cesium
From: https://www.cnblogs.com/hustshu/p/17089793.html