How to have animation along polyline with different location coordinates?

Hi everyone,

In need of urgent help!

I wish to have some kind of animation along the polyline that I've created - Something similar to the example that Hannah has provided (Refer below):

var startLongitude = -75;
var endLongitude = -125;
var latitude = 43;
    polyline : {
        positions : Cesium.Cartesian3.fromDegreesArray([startLongitude, latitude,
                                                               endLongitude, latitude]),
        width : 10,
        material : new Cesium.PolylineArrowMaterialProperty(Cesium.Color.PURPLE)

var geodesic = new Cesium.EllipsoidGeodesic(Cesium.Cartographic.fromDegrees(startLongitude, latitude), Cesium.Cartographic.fromDegrees(endLongitude, latitude));
var value = 0;
var cartographicPosition = new Cesium.Cartographic();
var point = viewer.entities.add({
    position: new Cesium.CallbackProperty(function(){
        var cartographic = geodesic.interpolateUsingFraction(value, cartographicPosition);
        var position = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude);
        value = value > 1 ? 0 : value + 0.005;
        return position;
    }, false),
    point: {
        color : Cesium.Color.PURPLE,
        pixelSize : 20

In the above example, only 1 latitude is being used throughout. However in my case, I have 2 different latitudes.

For instance:
Country A - Latitude: 47.0000, Longitude: 2.0000
Country B - Latitude: 38.8833, Longitude: 77.0167

I'm able to create a polyline, but i wish to have an animation along the polyline too. How do I go about doing it with the example above?

Thank you in advance!


Hello Alan,

This same method will work with different latitudes. Instead of using the same latitude with for both the start and end positions, use a [startLongitude, startLatitude, endLogitude, endLatitude] etc

Hope this helps!


Hi Hannah,

It is working now, thank you very much!