CesiumJS - How can I control viewer time and ticks?

Viewed 3557

What I'd like to do is control the clock ticks for a non-realtime Cesium application. Imagine there's expensive code running, plus I want to give the viewer time to load the tiles before continuing. So how do I disable automatic ticking, and then call tick() manually when my code is ready for it?

Docs for Cesium.Clock say "The clock will only tick when both Clock#canAnimate and Clock#shouldAnimate are true." but that's not what I'm getting. What I currently see:

viewer.clock.canAnimate = false;
viewer.clock.shouldAnimate = false;
viewer.clock.onTick.addEventListener(function(clock){
    console.log("Tick");
});

The result in the console shows the clock still ticking:

Tick
Tick
Tick
Tick
...

What I'd like to do:

viewer.clock.stopTicking(); // or whatever that command would be...
while (someCondition){
    // run expensive code
    tick(); // issue manual tick
}

Thanks for your help! Max

2 Answers
Related