Polylines "flash" when some parameter is changed

1. A concise explanation of the problem you’re experiencing.

I’m drawing some routes on the map as polylines.

I’d like my routes to change their width on the basis of camera height (the farther the camera, the thinner the polyline).

When the width of my routes is updated them “flash”, just like them was destroyed and created from scratch

(I’ve experienced the same problem also changing the polyline material)

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Track = viewer.entities.add({

polyline: {

positions: this.cartesianPositions,

clampToGround: false,

width: 6,

show: main.isTrackVisible,

material: this.defaultMaterial,



viewer.camera.changed.addEventListener(() => {

let maxWidth = 6;

let minWidth = 3.5;

let minHeight = 1;

let maxHeight = 6;

let clampedHeight = Math.clamp(height, minHeight, maxHeight);

let widthMult = 1 - Math.inverseLerp(minHeight, maxHeight, clampedHeight);

let width = minWidth + ((maxWidth - minWidth) * widthMult);

Track.polyline.width = width;


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I’d like my routes to change their width, and material, on the basis of camera height

4. The Cesium version you’re using, your operating system and browser.


Entities will “flash” like this because they are created asynchronously. If you know your entity is going to change a lot, consider using a CallbackProperty.

Here’s a thread with more detail on this issue: https://groups.google.com/d/msg/cesium-dev/5N1P_qPmbPo/rbnHNKFoAQAJ

Many thanks!