# Performance issues with entity animation

**URL:** https://community.cesium.com/t/performance-issues-with-entity-animation/3021
**Category:** CesiumJS
**Created:** [September 3, 2015, 7:49am UTC](https://community.cesium.com/t/performance-issues-with-entity-animation/3021 "2015-09-03T07:49:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![u12047822](https://avatars.discourse-cdn.com/v4/letter/u/c67d28/32.png) [@u12047822](https://community.cesium.com/u/u12047822)
#### Post date: [September 3, 2015, 7:49am UTC](https://community.cesium.com/t/performance-issues-with-entity-animation/3021/1 "2015-09-03T07:49:20Z")

</div>

Hey guys,

We're working on a university project where we are developing a satellite orbit viewer, which has to display the satellites' footprints.

Currently we're using JavaScript's setInterval function to update the footprint's position whenever the satellite moves. We've implemented it as follows:

Here is how the footprint entity is created:  
var currentAreaOnEarth =  
{  
&nbsp;&nbsp;&nbsp;position: Cesium.Cartesian3.fromDegrees(satPosition[0], satPosition[1]),  
&nbsp;&nbsp;&nbsp;ellipse: {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;semiMinorAxis: 250 \* footprint,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;semiMajorAxis: 250 \* footprint,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outline: true,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outlineColor: Cesium.Color.RED,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outlineWidth: 4,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;material: stripeMaterial  
&nbsp;&nbsp;&nbsp;}  
}

Here is were the setInterval for animation is configured:  
function animate() {  
&nbsp;&nbsp;Satellites.animateCurrentAreaOnEarth(cesiumViewer);  
&nbsp;&nbsp;Satellites.updateSatelliteInformation(cesiumViewer);  
};  
setInterval(animate, 150);

This is the function that does the updating of the entity's position at each interval:  
animateCurrentAreaOnEarth: function (cesiumViewer)  
{  
&nbsp;&nbsp;for (var i = 0; i \< this.arrayOfSatellites.length; ++i)  
&nbsp;&nbsp;{  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(this.satelliteFootprints[i].show == true)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{  
&nbsp;&nbsp;var satPosition = this.showSatellitePosition(cesiumViewer, i);  
&nbsp;&nbsp;this.satelliteFootprints[i].position = Cesium.Cartesian3.fromDegrees(satPosition[0], satPosition[1]);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;}  
}

The problem we are experiencing is that with many satellites the setInterval method causes a large performance hit. We were wondering if you could help us with how to animate these footprints similar to how the satellite entities are animated, or a way to attach these footprints to the satellite entities so that they move with the satellites themselves.

Thank you for any help you can provide us!

---

<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: [September 3, 2015, 6:52pm UTC](https://community.cesium.com/t/performance-issues-with-entity-animation/3021/2 "2015-09-03T18:52:24Z")

</div>

Hello,

I think this is because your ellipses are being computed asynchronously in a web worker. This is because the entity collection thinks the ellipse is going to be static since it has all static properties. To get around this, we can use a [CallbackProperty](http://cesiumjs.org/Cesium/Build/Documentation/CallbackProperty.html) for the positions argument to let the entity collection know it is going to be changing. See the example below:

var currentAreaOnEarth =

{  
position: new Cesium.CallbackProperty(getEllipsePosition, false),  
ellipse: {  
semiMinorAxis: 250 \* footprint,  
semiMajorAxis: 250 \* footprint,  
outline: true,  
outlineColor: Cesium.Color.RED,  
outlineWidth: 4,  
material: stripeMaterial  
}  
}

function getEllipsePosition() {  
return Cesium.Cartesian3.fromDegrees(satPosition[0], satPosition[1]);  
}

``

Best,

Hannah

---

<div class="post-metadata">

### Author: ![u12047822](https://avatars.discourse-cdn.com/v4/letter/u/c67d28/32.png) [@u12047822](https://community.cesium.com/u/u12047822)
#### Post date: [September 4, 2015, 9:52am UTC](https://community.cesium.com/t/performance-issues-with-entity-animation/3021/3 "2015-09-04T09:52:19Z")

</div>

Hi Hannah,

That solved the problem, thank you so much for the help!
