Wow thanks for the quick response.
I’ve managed to get what I was after working in the sandbox now (brief changes attached for anyone searching).
However, what if I just want to change 1 parameter of the material (eg the alpha) without having to take the whole material creation into a new function?
Do you know how this would work?
Thanks
Enter code here…var viewer = new Cesium.Viewer(‘cesiumContainer’);
``
// The viewModel tracks the state of our mini application.
var viewModel = {
alpha : '0.5',
};
// Convert the viewModel members into knockout observables.
Cesium.knockout.track(viewModel);
// Bind the viewModel to the DOM elements of the UI that call for it.
var toolbar = document.getElementById(‘toolbar’);
Cesium.knockout.applyBindings(viewModel, toolbar);
Cesium.knockout.getObservable(viewModel, ‘alpha’).subscribe(
function(newValue) {
entity.box.material = Cesium.Color.fromAlpha(Cesium.Color.BLUE,[newValue]);
}
);
var entity = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 300000.0),
box : {
dimensions : new Cesium.Cartesian3(400000.0, 300000.0, 500000.0),
material : Cesium.Color.fromAlpha(Cesium.Color.BLUE,viewModel.alpha)
}
});
@import url(../templates/bucket.css);
#toolbar {
background: rgba(42, 42, 42, 0.8);
padding: 4px;
border-radius: 4px;
}
#toolbar input {
vertical-align: middle;
padding-top: 2px;
padding-bottom: 2px;
}
#toolbar .header {
font-weight: bold;
}
Loading...
``