How to turn on and off animation and timeline after creating viewer

1. A concise explanation of the problem you’re experiencing.

I would like to turn on/off the clock, timeline and other buttons when the viewer switches between full screen and regular mode (change the viewer setting dynamically after creating the viewer).

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

this.viewer.animation = false;

this.viewer.timeline = false;

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

We have the viewer in a small pane on the homepage and the clock and buttons are too big in this view. I want them off until the viewer is in full screen.

4. The Cesium version you’re using, your operating system and browser.

cesium 1.61.0

Windows 10 Home

Chrome, Firefox

You would need to hide the element since it’s already been created. Here’s a Sandcastle example I just put together showing you how you can do this.

Although it seems like the Cesium ion logo doesn’t fall to the left when the animation widget disappears, possibly because you may need to hide the parent of the animation widget instead of the widget itself.


One way I just figured out was to get the element by the class name.

var animation = document.getElementsByClassName(“cesium-viewer-animationContainer”)[0]; = ‘none’;

I’ll try the method you did.