Dynamic Polyline with 2 points

I would like to have one polyline with 2 points that changes overtime. I know how to make an entity point change with positions using SamplePositionProperty and availability. But I cannot understand how to do it using a polyline. Polyline is different in that it has 2 points. So how can I make one polyline with 2 points change. Can you give me an example?

Polyline is just an array of Cartesian3 positions, so like any other entity, when using callbackProperty;

var myPositions = [];
// ...
   polyline: {
      positions: new Cesium.CallbackProperty( () => {
         return myPositions;

Any time you update the myPositions the entity will also update. Remember to check for valid positions, null or empty arrays and the like, but that’s the basics of it.



1 Like