frameend event

I’m animating a polyline over time by adding points to the head and removing them from the tail (think snake).

var viewer = new Cesium.Viewer('mapContainer');

var positions = [];

function randomInRange(from, to) {
  return Math.random() * (to - from) + from;

function pushRandomPosition() {
  var lat = randomInRange(-90, 90);
  var lon = randomInRange(-180, 180);
  var pos = new Cesium.Cartesuan3.fromDegrees(lat, lon);

for (var i = 0; i < 10; i++) {

var entity = viewer.entities.add({
  name: 'my_line',
  polyline: {
    positions: positions,
    material:  Cesium.Color.RED

setInterval(function () {

  // add to front

  // remove from end

  // update
  entity.polyline.positions =
      new Cesium.ConstantProperty(positions);

}, 1000);

To help with performance, I’m batching the updates together:


// batch update


I’m migrating from GoogleEarth, and there I would wait for the frameend event to know when to start the next batch.

Does cesium have something similar? I’m currently just throttling it.

Check and the other info on and


You dan use the Cesium clock ticks, see

Scene has a postRender event you can hook into to so that your batching can work similar to the prior Google Earth application.

Let me know if that works out for you.

-Mike lp