I would like to have a fade out delay on FadeInOutBehavior because I have seen issues where if the user gets too close to the mesh edge when trying to put the pointer over the UI, it will trigger the UI to fade out. This PG demonstrates what I am trying to achieve (the fadeOutDelay property doesn’t exist currently) https://playground.babylonjs.com/#5EK9SZ#5. I implemented the fade out delay along with some other changes to ensure that the fade in and out behave properly if the mesh is already visible/invisible or in transition in Add a fade out delay to FadeInOutBehavior by ericwood73 · Pull Request #13389 · BabylonJS/Babylon.js · GitHub. The checks for that PR are failing but I can’t find any information about why they failed. I wasn’t able to run the tests in my workspace due to an error Error: Could not resolve a module for a custom reporter. Module name: jest-screenshot/reporter
. I would appreciate any assistance in resolving the issues with the PR.
I set this up on a 2 second delay. You can change it as needed. https://playground.babylonjs.com/#5EK9SZ#7
Lines 38-61
var timeout = null;
// Disable on pointer out
avatar.actionManager.registerAction(new BABYLON.ExecuteCodeAction(
BABYLON.ActionManager.OnPointerOutTrigger,
(evt) => {
console.log(evt);
if(timeout){
clearTimeout(timeout);
}
timeout = setTimeout(function(){
fadeBehavior.fadeIn(false);
timeout = null;
},2000);
}
));
2 Likes