Created
December 12, 2016 18:32
-
-
Save jasonbeverage/17cd76c357ed55ed8b28abd8d8970225 to your computer and use it in GitHub Desktop.
Modify positions of a cesium polyline programatically.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var viewer = new Cesium.Viewer('cesiumContainer'); | |
var positions = Cesium.Cartesian3.fromDegreesArray([-75, 37, | |
-85, 37]); | |
var redLine = viewer.entities.add({ | |
name : 'Red line on the surface', | |
polyline : { | |
positions : positions, | |
width : 5, | |
material : Cesium.Color.RED | |
} | |
}); | |
viewer.zoomTo(viewer.entities); | |
var start = -85.0; | |
var lat = 37.0; | |
setInterval(function() { | |
start -= 1.0; | |
positions.push(Cesium.Cartesian3.fromDegrees(start, lat)); | |
console.log("Pushed..."); | |
redLine.polyline.positions = positions; | |
}, 500); |
It is a very useful post. thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for posting