Layer

A layer, also known as a track, is a container where you can place all your clips and transitions. Every new layer has a higher zIndex, which allows you to stack them on top of each other.

One of the best things about layers is that there's no restriction on what type of clip you can add to it. You can mix images, videos, and audio together.

Creating a Layer

To start building your timeline, you'll need to create a new layer. This is as simple as calling the createLayer() method on your engine's timeline:

const layer = engine.getTimeline().createLayer();

If you want to insert a layer at a specific position, you can provide an index parameter:

const layer = engine.getTimeline().createLayer({ index: 2 });

This is useful when you need to create a new layer in between existing ones.

Removing a Layer

When it's time to say goodbye to a layer, simply call the removeLayer() method on your engine's timeline and pass in the ID of the layer you want to remove:

engine.getTimeline().removeLayer(layerId);