Hey, everybody. I need to make smooth scaling for ImageMaterialProperty. Here is my code where I create Entity:
let plane = new Entity({
position: position,
orientation: orientation,
properties: {
type: 'icon'
},
parent: airObj,
name: 'Icon',
plane: {
show: true,
plane: new Plane(Cartesian3.UNIT_Z, 0.0),
dimensions: new Cartesian2(30000.0, 30000.0),
material: new ImageMaterialProperty({
image: airs,
transparent: true,
}),
}
})
I have my custom one but it shakes the picture too much:
cesium.viewer.scene.preRender.addEventListener(function () {
let cameraHeight = cesium.viewer.scene.camera.positionCartographic.height;
// var newSize = 25000.0 * (cameraHeight / 2000000);
// newSize = Math.max(newSize, 100.0);
dataSource.entities.values.forEach((item) => {
if (cameraHeight > minHeight && cameraHeight < maxHeight) item._children[0]._plane._dimensions.setValue(new Cartesian2(newSize, newSize));
if (cameraHeight > 1000000) {
item.model.show.setValue(false)
item._children[0].show = true;
}else {
item._children[0].show = false
item.model.show.setValue(true);
}
})
})
Thanks in advance for your advice and help!