首页 » cesiumjs » 正文

[cesiumjs]Cesium地球自转的样例代码

分享一下让Cesium地球自转的代码

var i = Date.now();</p>

<p>function rotate() {
    var a = .1;
    var t = Date.now();
    var n = (t - i) / 1e3;
    i = t;
    viewer.scene.camera.rotate(Cesium.Cartesian3.UNIT_Z, -a * n);
}</p>

<p>viewer.clock.onTick.addEventListener(rotate);
setTimeout(function() {
    viewer.clock.onTick.removeEventListener(rotate);
}, 5000);

原文链接:

http://cesiumcn.org/topic/69.html

发表评论

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax