Change Polyline Color depending on a parameter

Hello Cesium Team,

Depending on a parameter (e.g. speed) I would like to be able to have a different color for each segment of a trajectory. In the sandbox there is an example on how to change the width of a polyline but not on how to change its color. The others example I've looked change the color of a whole polygone collection.

By looking in the code source, I tried different solutions but none of them have worked.

This is what I'm doing right now but with no success:
http://pastebin.com/c3QKAwiw

Do you know how could I set the color of each segment?

Thanks

Arnaud

PolylineCollection.add returns a Polyline object. You should be able to either save that reference or get a reference from the collection, then update the material’s color later in your code. Something like:

myPolyline.getMaterial().uniforms.color = newColor;

Hello Mark,

It works perfectly.
Thanks

Arnaud