Skip to main content

Creating a Scene from Scratch

In this example, we will show you how to initialize the CreativeEditor SDK from scratch and add a star shape.

Explore a full code sample on Stackblitz or view the code on Github.

We create an empty scene via engine.scene.create() which sets up the default scene block with a camera attached. Afterwards, the scene can be populated by creating additional blocks and appending them to the scene. See Modifying Scenes for more details.

We first add a page with create(type: DesignBlockType): number specifying a "page" and set a parent-child relationship between the scene and this page.

To this page, we add a graphic block, again with create(type: DesignBlockType): number. To make it more interesting, we set a star shape and a color fill to this block to give it a visual representation. Like for the page, we set the parent-child relationship between the page and the newly added block. From then on, modifications to this block are relative to the page.

This example first appends a page child to the scene as would typically be done but it is not strictly necessary and any child block can be appended directly to a scene.

To later save your scene, see Saving Scenes.