Hi I Have want hide Plane shape through button click but i dont how to do.
Please can anyone help ?
Hi I Have want hide Plane shape through button click but i dont how to do.
Please can anyone help ?
Hello and welcome to BJS.
To make an object (your plane) or a mesh invisible in BJS, simply use:
plane.isVisible = false;
To make it visible:
plane.isVisible = true;
Thank you mawa for helping me,
I find with animation way but only one plane is hide not other rest why?
var addButton = function(index , ppname , pexcept , pageurl , panel, dome) {
var plane = BABYLON.MeshBuilder.CreatePlane("plane", {height:4.3, width:4 }, scene);
var mat = new BABYLON.StandardMaterial("", scene);
var textureResolution = 512;
var texture = BABYLON.GUI.AdvancedDynamicTexture.CreateForMesh(plane, 1024, 1024);
texture.hasAlpha = true;
var textureContext = texture.getContext();
mat.diffuseTexture = texture;
mat.diffuseTexture.hasAlpha = true;
mat.diffuseTexture.uScale = 1;
mat.diffuseTexture.vScale = 1;
mat.useAlphaFromDiffuseTexture = true;
var im5 = new BABYLON.GUI.Image("im5", "/media/banner0"+index+".png" );
texture.addControl(im5);
var gd = new BABYLON.GUI.Grid();
gd.addColumnDefinition(1);
gd.addRowDefinition(0.4);
gd.addRowDefinition(0.6);
texture.addControl(gd);
var text1 = new BABYLON.GUI.TextBlock();
text1.paddingLeft = 170;
text1.width = "80%";
text1.text = ppname;
text1.color = "white";
text1.fontSize = 60;
gd.addControl(text1,0,0);
var text2 = new BABYLON.GUI.TextBlock();
text2.width = "80%";
text2.textHorizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
text2.textVerticalAlignment = BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP;
text2.text = pexcept ;
text2.textWrapping =true;
text2.color = "white";
text2.fontSize = 60;
gd.addControl(text2,1,0);
mat.alpha = 0.9;
var button = new BABYLON.GUI.MeshButton3D(plane, "button" + index);
button.fire = function(e,a){
switch_page(button,panel,index,dome);
}
_r.SetObjectEvent.call(button);
controlbox_homepage.push(button);
panel.addControl(button);
alert(plane)
var buttonbox = document.createElement('div');
buttonbox.id = "buttonbox";
buttonbox.style.position = "absolute";
buttonbox.style.top = "60px";
buttonbox.style.left = "85%";
buttonbox.style.border = "5pt inset blue";
buttonbox.style.padding = "2pt";
buttonbox.style.paddingRight = "2pt";
buttonbox.style.width = "10em";
buttonbox.style.display = "block";
document.body.appendChild(buttonbox);
var b14 = document.createElement('button');
b14.id = "ShowHidemyMeshesOne";
b14.textContent = "Show/Hide myMeshesOne";
b14.style.display = "block";
b14.style.width = "100%";
b14.style.fontSize = "1.1em";
buttonbox.appendChild(b14);
// b14.onclick = function() {
// for (mesh of myMeshesOnes)
// mesh.setEnabled((mesh.isEnabled() ? false : true));
// }
var hide = function(node) {
BABYLON.Animation.CreateAndStartAnimation("hide", node, "visibility", 30, 30, 1, 0, 0)
}
b14.onclick = function() {
hide()
}
}
It would be easier to help if you put your code into Playground