You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Playing with Vue 3 composables and Babylon JS. I think this could be a valuable way to create modular, reusable, and reactive objects.
New composable called Title Card (in a folder called “composables”. Title Card exports a function which creates the title card and returns two reactive refs as an object. Internal watch functions will update the Babylon JS GUI anytime the ref values change.
constcreateTitleCard=(scene)=>{// The data that we will display in the VR consolelettitle=ref("TITLE PLACEHOLDER");letsubtitle=ref("SUBTITLE PLACEHOLDER");// Babylon JS GUI code here, removed for brevity // Watch the title and subtitle for changes// and update the text in the GUIwatch(title,(newValue)=>{consttexture=scene.getTextureByName("title-card-texture");texture.getControlByName("title-text").text=newValue;});watch(subtitle,(newValue)=>{consttexture=scene.getTextureByName("title-card-texture");texture.getControlByName("subtitle-text").text=newValue;});return{ title, subtitle };};exportdefaultcreateTitleCard;
The scene uses this function and destructures the result.
Playing with Vue 3 composables and Babylon JS. I think this could be a valuable way to create modular, reusable, and reactive objects.
New composable called Title Card (in a folder called “composables”. Title Card exports a function which creates the title card and returns two reactive refs as an object. Internal watch functions will update the Babylon JS GUI anytime the ref values change.
The scene uses this function and destructures the result.
The text was updated successfully, but these errors were encountered: