Usage
To create a new project, you’ll use theprojects.create() method of the BlendDuck client.
When creating a new project, there is at least one
Clip in the Project.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create a new project using Project object
projects.create() method of the BlendDuck client.
import BlendDuck, { Project, Clip, Text, Animation, AnimationType } from "@blendduck/node-sdk";
// Initialize the BlendDuck client
const client = new BlendDuck({
apiKey: process.env.BLENDDUCK_API_KEY
});
async function createProject() {
// Create a new project
const project = new Project();
project.title = "My New Video Project";
project.ratio = "16:9";
// Create a clip
const clip = new Clip(5); // 5-second clip
// Add a text element to the clip
const textElement = new Text();
textElement.text = "Hello, BlendDuck!";
textElement.x = 960; // Center horizontally (assuming 1920x1080 resolution)
textElement.y = 540; // Center vertically
textElement.fontSize = 60;
// Add a fade-in animation to the text
const fadeIn = new Animation(AnimationType.FadeIn);
fadeIn.startTime = 0;
fadeIn.endTime = 1;
textElement.addAnimation(fadeIn);
// Add the text element to the clip
clip.addElement(textElement);
// Add the clip to the project
project.addClip(clip);
// Create the project on BlendDuck
const projectId = await client.projects.create(project);
console.log(`Project created successfully! ID: ${projectId}`);
console.log(`Edit your project at: https://blendduck.com/editor/${projectId}`);
}
// Usage
createProject();
Clip in the Project.