import React from "react"; import { AbsoluteFill, interpolate, spring, useCurrentFrame, useVideoConfig } from "remotion"; import { FONT } from "../../lib/fonts"; import { hexToRgba } from "../../lib/anim"; import { ThreeBackdrop, Grain, Vignette, ProgressDots, Kicker, useSceneTransition } from "../chrome"; import type { BlockProps, SceneBlock } from "../types"; const Slideshow: React.FC = ({ data, colors, L, index, total, durationInFrames }) => { const frame = useCurrentFrame(); const { fps } = useVideoConfig(); const { opacity, slide } = useSceneTransition(durationInFrames, L); const items = [data.slide1, data.slide2, data.slide3, data.slide4].filter((s) => s && s.trim()); // distribute reveals across the available time (after the title settles) const start = 14; const span = Math.max(18, (durationInFrames - start - 14) / Math.max(1, items.length)); return (
{data.title}
{items.map((s, i) => { const sp = spring({ frame: frame - (start + i * span), fps, config: { damping: 18, stiffness: 110 } }); const x = interpolate(sp, [0, 1], [L.vmin(50), 0]); return (
{String(i + 1).replace(/[0-9]/g, (d) => "۰۱۲۳۴۵۶۷۸۹"[+d])} {s}
); })}
); }; export const SlideshowBlock: SceneBlock = { id: "Slideshow", label: "اسلایدشو (فهرست)", component: Slideshow, fields: [ { key: "title", label: "عنوان", type: "text", default: "چرا فلت‌رندر؟" }, { key: "slide1", label: "مورد ۱", type: "text", default: "ساخت ویدیو در چند دقیقه" }, { key: "slide2", label: "مورد ۲", type: "text", default: "بدون نیاز به دانش فنی" }, { key: "slide3", label: "مورد ۳", type: "text", default: "خروجی با کیفیت حرفه‌ای" }, { key: "slide4", label: "مورد ۴", type: "text", default: "" }, ], defaultDurationSec: 6, minDurationSec: 3, maxDurationSec: 12, };