# dynamic polyline cesium(best practices?)

**URL:** <https://community.cesium.com/t/dynamic-polyline-cesium-best-practices/5070>\
**Category:** CesiumJS\
**Created:** [January 23, 2017, 11:46pm UTC](https://community.cesium.com/t/dynamic-polyline-cesium-best-practices/5070 "2017-01-23T23:46:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eladcool0](https://avatars.discourse-cdn.com/v4/letter/e/8dc957/32.png) [@eladcool0](https://community.cesium.com/u/eladcool0)\
**Post date:** [January 23, 2017, 11:46pm UTC](https://community.cesium.com/t/dynamic-polyline-cesium-best-practices/5070/1 "2017-01-23T23:46:09Z")

</div>

Well i still dont understand what is the best practices of drawing dynamic polyline.

let me explain the scenario, there is an event dont every ~30ms happend , in this event i want to draw polyline with constant point and dynamic point that located on a specific imaginery circle.

i want to visualized the circle like the radius whom represented by the polyline is moving around the circle , so lets asume in every 30ms the center point of the circle is always the same point and the other point change along with radius of the circle and the specific angle so lets asume in every 30ms the poline rotate right like the clock.

its like visual clock that every 30ms is moving one angle till it gets to the 360 and then returened to 0 and etc..

how can i implement this kind of animation using best performances?

---

<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:** [January 24, 2017, 1:36pm UTC](https://community.cesium.com/t/dynamic-polyline-cesium-best-practices/5070/2 "2017-01-24T13:36:49Z")

</div>

Hello,

I would recommend using a callback property to update the positions in the polyline. Here is an example:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var position1 = Cesium.Cartesian3.fromDegrees(-75, 35);  
var lon = -75;  
var position2 = Cesium.Cartesian3.fromDegrees(lon, 35);  
var positions = [position1, position2];  
function callback(){  
lon -= 0.05;  
position2 = Cesium.Cartesian3.fromDegrees(lon, 35, undefined, undefined, position2);  
return positions;  
}

viewer.entities.add({  
polyline : {  
positions : new Cesium.CallbackProperty(callback, false),  
width : 5,  
material : Cesium.Color.RED  
}  
});

``

Best,

Hannah
