# How to only rotate the globe?

**URL:** <https://community.cesium.com/t/how-to-only-rotate-the-globe/3506>\
**Category:** CesiumJS\
**Created:** [December 28, 2015, 2:31am UTC](https://community.cesium.com/t/how-to-only-rotate-the-globe/3506 "2015-12-28T02:31:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alan\_Sullivan](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Alan\_Sullivan](https://community.cesium.com/u/Alan_Sullivan)\
**Post date:** [December 28, 2015, 2:31am UTC](https://community.cesium.com/t/how-to-only-rotate-the-globe/3506/1 "2015-12-28T02:31:35Z")

</div>

Hi all,

Is there a way for me to auto-rotate the globe?  
Previously, I found this few lines of codes in this thread, I think, and tested it out:

var lastNow = Date.now();  
viewer.clock.onTick.addEventListener(function(clock) {  
&nbsp;&nbsp;&nbsp;&nbsp;var now = Date.now();  
&nbsp;&nbsp;&nbsp;&nbsp;var spinRate = 0.08;  
&nbsp;&nbsp;&nbsp;&nbsp;var delta = (now - lastNow) / 1000;  
&nbsp;&nbsp;&nbsp;&nbsp;lastNow = now;  
&nbsp;&nbsp;&nbsp;&nbsp;viewer.scene.camera.rotate(Cesium.Cartesian3.UNIT\_Z, -spinRate \* delta);  
});

So with these lines of codes, the globe/camera (i'm not sure which) was able to rotate on its own. However as I changed the view to either 2D Map or 2.5D Columbus View, they will rotate as well.

Therefore my question is, how do I only make the 3D globe rotate?

Appreciate any help!

Thanks.

Alan

---

<div class="post-metadata">

**Author:** ![Willem](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@Willem](https://community.cesium.com/u/Willem)\
**Post date:** [December 28, 2015, 11:54am UTC](https://community.cesium.com/t/how-to-only-rotate-the-globe/3506/2 "2015-12-28T11:54:39Z")

</div>

You could check the scene.mode ([http://cesiumjs.org/Cesium/Build/Documentation/Scene.html#mode](http://cesiumjs.org/Cesium/Build/Documentation/Scene.html#mode)) in your event handler and only rotate when the mode is 3D.  
You probably also need to reset e.g. lastNow to avoid sudden jumps when going back to 3D.

I did not see an event for a scene.mode change.

Willem

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [December 29, 2015, 12:33am UTC](https://community.cesium.com/t/how-to-only-rotate-the-globe/3506/3 "2015-12-29T00:33:14Z")

</div>

Hello Alan,

Take a look at the ‘View in ICRF’ example in this demo: [http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Camera.html&label=Showcases](http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Camera.html&label=Showcases)

Is that what you’re looking for?

Best,

Hannah
