var viewer = new Cesium.Viewer(‘cesiumContainer’, {});
function computeCircle(radius) {
var positions = [];
for (var i = 0; i < 360; i++) {
var radians = Cesium.Math.toRadians(i);
positions.push(new Cesium.Cartesian2(radius * Math.cos(radians), radius * Math.sin(radians)));
}
return positions;
}
var line = viewer.entities.add({
polylineVolume : {
positions : Cesium.Cartesian3.fromDegreesArrayHeights([49.1641293, -5.3639241, 50,
3.535853, 9.809184 ,50]),
shape : computeCircle(20),
material : Cesium.Color.GREEN.withAlpha(0.3)
}
});
viewer.clock.onTick.addEventListener(function() {
line.material = new Cesium.Color.RED.withAlpha(0.3);
});
I am trying to change the color of the line on every tick but i can not do it.
Why this code is not working?