@theatre/studio
studio.initialize()
Initializes the studio. Call it once in your index.js/index.ts module. It silently ignores subsequent calls.
studio.transaction(fn)
Runs an undo-able transaction. Creates a single undo level for all the operations inside the transaction.
Will roll back if an error is thrown.
api.set(pointer, value)
Set the value of a prop by its pointer. If the prop is sequenced, the value will be a keyframe at the current sequence position.
api.unset(pointer, value)
Unsets the value of a prop by its pointer.
studio.scrub()
Creates a scrub, which is just like a transaction, except you can run it multiple times without creating extra undo levels.
studio.extend(extension)
Registers an extension. Extensions enable you to extend the Studio's UI and/or extend the functionality of Studio. Read more about working with extensions in the "Authoring extensions" manual.
studio.createContentOfSaveFile(projectId)
Creates a JSON object that contains the state of the project. You can use this to programmatically save the state of your projects to the storage system of your choice, rather than manually clicking on the "Export" button in the UI.
studio.createPane(paneClass)
Creates a new pane. Takes a string as its argument specifying a pane class previously registered by an extension.
studio.getStudioProject()
Returns the Theatre.js project that contains the studio's sheets and objects.
It is useful if you'd like to have sheets/objects that are present only when the studio is present.
studio.selection
The current selection, consisting of sheets and sheet objects.
studio.onSelectionChange(callback)
Let's you subscribe to selection changes. Calls the provided callback with the current selection every time the selection changes.
studio.setSelection(selection)
Sets the current selection.
studio.ui
Exposes utilities to manipulate the Studio UI.
studio.ui.hide()
Hides the Studio.
studio.ui.restore()
Shows the Studio.
studio.ui.isHidden
true
if Studio is hidden currently.
studio.ui.renderToolset(toolsetId, container)
Let's you render a toolset previously defined by an extension into a dom node of your choice.
Was this article helpful to you?
Last edited on February 01, 2024.
Edit this page