Custom observable to fade out TextBlock

I am attempting to use a custom observable to animate a TextBlock’s alpha value to 0. The goal is to make it transparent after receiving a message from an external library.

I have a playground here that accomplishes the fade out with onBeforeRenderObservable, but this is the textbook example with scene.onBeforeRenderObservable.add(...) and it doesn’t require any notification.

In the documentation, the socket.io example does not appear to work if used as-is, because notifyObservers() requires a number of arguments that are not explained in the docs, and I’m struggling to understand how to use it from the Typedocs as well:

Does anyone have a working example of a custom observable that starts after receiving an event from an external library? Docs seem pretty sparse on this one and I believe I’ve used every Google query known to man with little to show for it.

Hello! :slight_smile:

notifyObserver’s parameters are optional, only needed if you want to pass some data to the observers.I tried making a simple example based on socket.io’s Code Sandbox starter, that starts spinning the cube once a connection is established:
Babylon and Socket.io connection - CodeSandbox
Hope it helps :smiley:

3 Likes

Thanks @carolhmj , this is very helpful. Was having trouble using external libraries in the playground. Cheers.

2 Likes