Caption Matrix Decode
framecn/caption-matrix-decodeFreeComponent
Matrix-style green text decodes from blur to sharp on each word.
Install it
npx shadcn@latest add https://framecn.dev/r/caption-matrix-decode.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 CaptionMatrixDecodeProps {13 words?: CaptionWord[];14 color?: string;15 fontSize?: number;16 fontWeight?: number | string;17 background?: string;18 speed?: number;19 fps?: number;20 durationInFrames?: number;21 width?: number;22 height?: number;23 className?: string;24}2526const DEFAULT_WORDS: CaptionWord[] = [27 { end: 0.35, start: 0, text: "Every" },28 { end: 0.65, start: 0.35, text: "great" },29 { end: 1, start: 0.65, text: "video" },30 { end: 1.45, start: 1.1, text: "starts" },31 { end: 1.65, start: 1.45, text: "with" },32 { end: 1.8, start: 1.65, text: "a" },33 { end: 2.15, start: 1.8, text: "single" },34 { end: 2.7, start: 2.15, text: "frame." },35 { end: 3.2, start: 3, text: "No" },36 { end: 3.9, start: 3.2, text: "timelines." },37 { end: 4.2, start: 4, text: "No" },38 { end: 4.5, start: 4.2, text: "drag" },39 { end: 4.65, start: 4.5, text: "and" },40 { end: 5.1, start: 4.65, text: "drop." },41 { end: 5.55, start: 5.3, text: "Just" },42 { end: 6, start: 5.55, text: "code." },43];4445const WORDS_PER_GROUP = 3;4647export const CaptionMatrixDecode = ({48 words = DEFAULT_WORDS,49 color = "#00ff41",50 fontSize = 80,51 fontWeight = 700,52 background = "#0a0a0a",53 speed = 1,54 fps = 30,55 durationInFrames = 180,56 width = 1280,57 height = 720,58 className,59}: CaptionMatrixDecodeProps) => {60 const safeSpeed = Math.max(0.01, speed);61 const durationMs = (durationInFrames / fps) * 1000;6263 const groups = [];64 for (let i = 0; i < words.length; i += WORDS_PER_GROUP) {65 const groupWords = words.slice(i, i + WORDS_PER_GROUP);66 groups.push({67 endMs: ((groupWords.at(-1)?.end ?? 0) * 1000) / safeSpeed + 180,68 startMs: (groupWords[0].start * 1000) / safeSpeed,69 words: groupWords,70 });71 }7273 const containerStyle: CSSProperties = {74 background,75 height,76 overflow: "hidden",77 position: "relative",78 width,79 };8081 return (82 <Timegroup83 className={className}84 duration={`${durationMs}ms`}85 mode="fixed"86 style={containerStyle}87 >88 <>89 <style>{`90 @keyframes framecn-cmd-grp-in {91 from { opacity: 0; }92 to { opacity: 1; }93 }94 @keyframes framecn-cmd-grp-out {95 from { opacity: 1; }96 to { opacity: 0; }97 }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 |
