Hi Gabby,
Thanks for the reply. My mistake, I did a few more troubleshooting and the problem in my app actually exists in both incognito mode and the normal mode.
I've tried sandcastle to replicate the problem and apparently it seems to be working fine...
It may just be my issue, suspected memory leak somewhere but to no avail. Will keep investigate and keep u updated.
Here's a sample of the code.
var viewer = new Cesium.Viewer('cesiumContainer', {
animation: false
});
viewer.clock.startTime = new Cesium.JulianDate();
Cesium.JulianDate.addSeconds(viewer.clock.startTime, 2, viewer.clock.stopTime);
viewer.clock.currentTime = viewer.clock.startTime;
viewer.clock.clockRange = Cesium.ClockRange.CLAMPED;
viewer.clock.onTick.addEventListener(function(clock){
if(Cesium.JulianDate.equals(clock.currentTime, clock.stopTime)){
clock.shouldAnimate = false;
}
});
var data = ;
function createMultipleBillboards() {
var rect = viewer.camera.computeViewRectangle();
generate1000EntitiesData(rect);
viewer.entities.suspendEvents();
for (var x = 0; x < data.length; x++) {
var newPos = Cesium.Cartesian3.fromRadians(data.lon, data.lat);
var entity = viewer.entities.getOrCreateEntity(data.id);
entity.position = getSampledPosition(entity, newPos, viewer.clock.startTime, viewer.clock.stopTime);
entity.billboard = {
image : '../images/facility.gif'
};
}
viewer.entities.resumeEvents();
}
function getSampledPosition(entity, newPos, startTime, stopTime){
var sampledPosProperty = new Cesium.SampledPositionProperty();
if(Cesium.defined(entity.position)){
sampledPosProperty.addSample(startTime, entity.position.getValue(stopTime));
sampledPosProperty.addSample(stopTime, newPos);
return sampledPosProperty;
}else{
return newPos;
}
}
function playAnimation() {
viewer.clock.currentTime = viewer.clock.startTime;
viewer.clock.shouldAnimate = true;
}
function generate1000EntitiesData(rect) {
data = ;
for (var x = 0; x < 1000; x++) {
data.push({
id: x,
lon: getRandomInRange(rect.west, rect.east, 3),
lat: getRandomInRange(rect.south, rect.north, 3),
});
}
}
function getRandomInRange(from, to, fixed) {
return (Math.random() * (to - from) + from).toFixed(fixed) * 1;
// .toFixed() returns string, so ' * 1' is a trick to convert to number
}
viewer.camera.moveEnd.addEventListener(function () {
createMultipleBillboards();
playAnimation();
});
setInterval(function(){
createMultipleBillboards();
playAnimation();
}, 5000);