Update an existing project
projects.update()
import BlendDuck, { Text, Animation, AnimationType } from "@blendduck/node-sdk"; // Initialize the BlendDuck client const client = new BlendDuck({ apiKey: process.env.BLENDDUCK_API_KEY }); async function updateProject(projectId: string) { // Retrieve the existing project const project = await client.projects.get(projectId); // Modify project properties project.title = "Updated Video Project"; // Add a new clip const newClip = new Clip(3); // 3-second clip const newText = new Text(); newText.text = "New content!"; newText.x = 960; newText.y = 540; newText.fontSize = 48; const fadeIn = new Animation(AnimationType.FadeIn); fadeIn.startTime = 0; fadeIn.endTime = 1; newText.addAnimation(fadeIn); newClip.addElement(newText); project.addClip(newClip); const firstClip = project.clips[0]; firstClip.duration = 6; // Change duration to 6 seconds // Modify an existing text element (assuming the first element is text) if (firstClip.elements.length > 0 && firstClip.elements[0].type === 'text') { const textElement = firstClip.elements[0] as Text; textElement.text = "Updated text content"; textElement.fontSize = 72; } // Update the project on BlendDuck await client.projects.update(project); console.log(`Project updated successfully! ID: ${project.id}`); console.log(`Edit your updated project at: https://blendduck.com/editor/${project.id}`); } // Usage updateProject("your-project-id-here");