/** @jsxImportSource vargai */
import { Render, Clip, Image, Video, Speech, Captions, Music } from "vargai/react"
import { createVarg } from "vargai/ai"
const varg = createVarg({ apiKey: process.env.VARG_API_KEY! })
const character = Image({
model: varg.imageModel("nano-banana-pro"),
prompt: "friendly young woman, casual outfit, natural lighting, looking at camera",
aspectRatio: "9:16",
})
const SCENES = [
{ text: "Hey guys! Today I'm reviewing the best coffee makers under 100 dollars.", motion: "person smiling, waving at camera" },
{ text: "Number one is the AeroPress. It's portable, easy to clean, and makes amazing coffee.", motion: "person talking enthusiastically, gesturing" },
{ text: "That's it for today! Don't forget to like and subscribe.", motion: "person waving goodbye, big smile" },
]
const voiceovers = SCENES.map(scene =>
Speech({
model: varg.speechModel("eleven_v3"),
voice: "elli",
children: scene.text,
})
)
export default (
<Render width={1080} height={1920}>
<Music prompt="upbeat pop, cheerful, catchy" model={varg.musicModel()} volume={0.1} duration={20} />
{SCENES.map((scene, i) => (
<Clip key={i} duration={5} transition={{ name: "fade", duration: 0.3 }}>
<Video
prompt={{ text: scene.motion, images: [character] }}
model={varg.videoModel("kling-v3")}
/>
</Clip>
))}
{voiceovers.map((vo, i) => (
<Captions key={i} src={vo} style="tiktok" color="#ffffff" withAudio />
))}
</Render>
)