1. A concise explanation of the problem you're experiencing.
For a wall geometry. when I try to add a callback property to the material, it fails.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
var entities = ;
for (var idx =0; idx<IDList.length; idx++) {
var colorCallbackFunction = (function(){
var ID = IDList[idx];
return function(time,result) {
var value = sampledData.getValue(time);
if (value) {
// Value of 120 and above would be red;
// value of zero and below are blue
var HSLValue = 0.65 - 0.65 / 120.0 * value;
HSLValue = Math.min(Math.max(HSLValue, 0), 0.65);
return Cesium.Color.fromHsl(HSLValue, 1, 0.5, 0.5);
} else {
return Cesium.Color.RED.withAlpha(0.5);
}
}
})();
// similar stuff for positionCallbackFunction
var entity = {
name: "ID: " + IDList[idx],
wall: {
positions: new Cesium.CallbackProperty(positionCallbackFunction, false),
material: new Cesium.CallbackProperty(colorCallbackFunction, false) // This would fail
// material: Cesium.Color.RED.withAlpha(0.5) // this is OK; but everything is a fixed color then.
}
};
entities.push(entity);
}
Later I add the entities to the viewer.
If I choose the constant color everything works just fine;
However, if I set the colorCallbackFunction I get the following error:
An error occurred while rendering. Rendering has stopped.
TypeError: materialProperty.getType is not a function
TypeError: materialProperty.getType is not a function
at Function.MaterialProperty.getValue (http://localhost:8080/cesium.js:29482:37)
at DynamicGeometryUpdater.update (http://localhost:8080/cesium.js:168392:45)
at DynamicGeometryBatch.update (http://localhost:8080/cesium.js:156631:27)
at GeometryVisualizer.update (http://localhost:8080/cesium.js:156834:36)
at DataSourceDisplay.update (http://localhost:8080/cesium.js:154996:37)
at Viewer._onTick (http://localhost:8080/cesium.js:247135:49)
at Event.raiseEvent (http://localhost:8080/cesium.js:2361:30)
at Clock.tick (http://localhost:8080/cesium.js:54620:21)
at CesiumWidget.render (http://localhost:8080/cesium.js:227663:43)
at render (http://localhost:8080/cesium.js:227039:32)
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I want to have a moving wall with changing color showing certain properties
4. The Cesium version you're using, your operating system and browser.
"cesium": "^1.42.1",