Clip is a container for visual and audio elements, with its own duration and transition effects.

Properties

PropertyTypeDefaultDescription
idstringuuid()A unique identifier for the clip.
durationnumber5The length of the clip in seconds.
durationLockbooleanfalseA boolean indicating whether the duration is locked or can be adjusted in the editor.
transitionstringnoneThe type of transition effect when moving to the next clip(e.g., none, fade, wipe, flip, slide, clock)
elementsarray[]An array of Element objects contained within the clip
audiosarray[]An array of AudioPlay objects for audio tracks in the clip
backgroundobjectnullOptional background settings for the clip, which can override the project’s theme

Usage

Here’s an example of how to create and customize a Clip using the BlendDuck SDK:

import BlendDuck, { Clip, Text, AudioPlay } from "@blendduck/node-sdk";

const clip = new Clip(5); // Create a 5-second clip
clip.transition = 'fade';

// Add a text element to the clip
const textElement = new Text();
textElement.text = "Hello, BlendDuck!";
clip.addElement(textElement);

// Add an audio track to the clip
const audio = new AudioPlay({ url: "https://s.blendduck.com/audios/motivation.mp3" });
clip.addAudioPlay(audio);

// Set a custom background for this clip
clip.background = {
  color: {
    type: "color",
    color: "#00ff33ff"
  }
};

Get the final JSON representing of the Clip

const json = clip.toJSON();

You can create Clip by JSON directly

const clip = Clip.fromJSON(json)