Caption Particle Burst
framecn/caption-particle-burstFreeComponent
Captions where each word explodes into particles as it exits.
Install it
npx shadcn@latest add https://framecn.dev/r/caption-particle-burst.jsonSource
1"use client";23import { Timegroup } from "@editframe/react";4import type { CSSProperties } from "react";56export interface CaptionWord {7 text: string;8 start: number;9 end: number;10}1112export interface CaptionParticleBurstProps {13 words?: CaptionWord[];14 color?: string;15 burstColor?: string;16 fontSize?: number;17 fontWeight?: number | string;18 background?: string;19 speed?: number;20 fps?: number;21 durationInFrames?: number;22 width?: number;23 height?: number;24 className?: string;25}2627const DEFAULT_WORDS: CaptionWord[] = [28 { end: 0.35, start: 0, text: "Every" },29 { end: 0.65, start: 0.35, text: "great" },30 { end: 1, start: 0.65, text: "video" },31 { end: 1.45, start: 1.1, text: "starts" },32 { end: 1.65, start: 1.45, text: "with" },33 { end: 1.8, start: 1.65, text: "a" },34 { end: 2.15, start: 1.8, text: "single" },35 { end: 2.7, start: 2.15, text: "frame." },36 { end: 3.2, start: 3, text: "No" },37 { end: 3.9, start: 3.2, text: "timelines." },38 { end: 4.2, start: 4, text: "No" },39 { end: 4.5, start: 4.2, text: "drag" },40 { end: 4.65, start: 4.5, text: "and" },41 { end: 5.1, start: 4.65, text: "drop." },42 { end: 5.55, start: 5.3, text: "Just" },43 { end: 6, start: 5.55, text: "code." },44];4546const WORDS_PER_GROUP = 3;4748export const CaptionParticleBurst = ({49 words = DEFAULT_WORDS,50 color = "#ffffff",51 burstColor = "#fbbf24",52 fontSize = 80,53 fontWeight = 900,54 background = "#0a0a0a",55 speed = 1,56 fps = 30,57 durationInFrames = 180,58 width = 1280,59 height = 720,60 className,61}: CaptionParticleBurstProps) => {62 const safeSpeed = Math.max(0.01, speed);63 const durationMs = (durationInFrames / fps) * 1000;6465 const groups = [];66 for (let i = 0; i < words.length; i += WORDS_PER_GROUP) {67 const groupWords = words.slice(i, i + WORDS_PER_GROUP);68 groups.push({69 endMs: ((groupWords.at(-1)?.end ?? 0) * 1000) / safeSpeed + 180,70 startMs: (groupWords[0].start * 1000) / safeSpeed,71 words: groupWords,72 });73 }7475 const containerStyle: CSSProperties = {76 background,77 height,78 overflow: "hidden",79 position: "relative",80 width,81 };8283 return (84 <Timegroup85 className={className}86 duration={`${durationMs}ms`}87 mode="fixed"88 style={containerStyle}89 >90 <>91 <style>{`92 @keyframes framecn-cpb-grp-in {93 from { opacity: 0; }94 to { opacity: 1; }95 }96 @keyframes framecn-cpb-grp-out {97 from { opacity: 1; }98// … truncated
What it pulls in
npm packages
Files it writes
More from framecn
All 101 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AI Generate Overlayai-generate-overlay | framecn | Components | Free | 1 dep | |
| AI Generation Canvasai-generation-canvas | framecn | Components | Free | 1 dep | |
| Animated Bar Chartanimated-bar-chart | framecn | Components | Free | 1 dep | |
| Animated Line Chartanimated-line-chart | framecn | Components | Free | 1 dep | |
| Backdropbackdrop | framecn | Components | Free | 1 dep | |
| Blur Out Upblur-out-up | framecn | Components | Free | 1 dep | |
| Blur Revealblur-reveal | framecn | Components | Free | 1 dep | |
| Bounding Box Selectorbounding-box-selector | framecn | Components | Free | 1 dep |
