Getting started
Importing
Design process
3D Configurator
Variables & Expressions (Beta)
Scene and project settings
Sharing, exporting, embedding
Other
Figma Plugin - Vectary 3D Studio Lite
Model API
How to start using our API on one of the embedded models on your site
The easiest way to start using our API is to import it as a module and create an instance while passing the DOM id of the iframe
(web component
coming soon ⏳).
Wait for it to be initialized and from there on, you are all set.
If you have more models to connect to, you will need to create a new instance of the API for each one of them.
https://codesandbox.io/embed/init-00jr7l?autoresize=1&expanddevtools=1&fontsize=14&hidenavigation=1&theme=dark&codemirror=1
Since the API needs to connect to an iframe
, all the methods go through ****PostMessage events
- because of that they all return as a Promise
.
Since we are returning promises, any errors that might happen when running any of the methods will trigger the rejection of the promise with the following format:
{
status: "error",
error?: string
}
init
Initializes the API instance connecting to the model.
init(): Promise<void>
Usage:
await modelApi.init();