I would like to move a cube after hitting the HTML button in UI.
I used HTML button scripts from the tutorials page.
I would like to tween (move the box from position A to position B).
I’ve uploaded tween.js into the project. Should I bind it to the root or will it work without any binding?
I would like to open and close the door with an HTML button using the Tween library.
The best would be when one button would open and close the same door.
I would want to use a few buttons at the same time. For now, only the first button works correctly.
For now, I only made what is visible on that scene.
When I put code into html-handler.js to add second button or to communicate with ‘door_loc’ object where should be Tween then I couldn’t find it to use stop() on it.
So if you will tell me how to find that tween object from ‘door_loc’ model then I will have a possibility to steer it with HTML buttons.
You want to have tween the door opening/closed based on the state of the door. For simplicity, I would create a new script that controls the animation of the door and have the HTML button call a function to toggle the state.
I’ve added logic so that the duration of the tween is dependent on how much the door is open. This stops it doing a slow tween when it’s partly open
Where did you add your code, I can see only that openCloseDoor.js file but after uploading that script it doesn’t work as in your forked version (the door doesn’t rotate after hitting the button). What should I change more to have the same what you reached? I`m trying to understand this.
Thanks for your effort in helping me. Much appreciated.
On this callback, you could fire an app wide event or set a property in the script and whatever is controlling your UI can show/hide what it needs to when the tween is complete.