Fire that ShapeDiver's initialisation is finished (loading)

Hello,

I’m embedding ShapeDiver Viewer directly to my webpage through ticket, but the model is relatively big so it takes some time to complete first initialisation. It would be nice to have some loading spinner so that visitors can see that something is happening and they don’t see just empty screen.

To do so I need ShapeDiver to fire some message that first initialisation has been finished, but I can’t find out how to achieve that.

Any ideas?

By the way, when ShapeDiver is not directly initialized then we can see ShapeDiver logo. In my case I want something similar but instead of Logo I’d like to have a spinning loader or something.

If you are using the version 2 of the viewer, you can start showing a spinner as soon as you create a session and listen to the VISIBILITY_ON viewer event to decide when to stop showing it.

In version 3, the createSession function returns a promise when the loading ends, so you could show a spinner when calling the function and hide it when the promise returns.

1 Like

Thanks a lot Mathieu for fast and correct answer. Works great now!