Caption Editorial Emphasis
framecn/caption-editorial-emphasisFreeComponent
Headline-style captions that emphasise specific words using accent colors and weight shifts.
Install it
npx shadcn@latest add https://framecn.dev/r/caption-editorial-emphasis.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 CaptionEditorialEmphasisProps {13 words?: CaptionWord[];14 emphasisWords?: string[];15 color?: string;16 fontSize?: number;17 fontWeight?: number | string;18 emphasisScale?: number;19 background?: string;20 speed?: number;21 fps?: number;22 durationInFrames?: number;23 width?: number;24 height?: number;25 className?: string;26}2728const DEFAULT_WORDS: CaptionWord[] = [29 { end: 0.35, start: 0, text: "Every" },30 { end: 0.65, start: 0.35, text: "great" },31 { end: 1, start: 0.65, text: "video" },32 { end: 1.45, start: 1.1, text: "starts" },33 { end: 1.65, start: 1.45, text: "with" },34 { end: 1.8, start: 1.65, text: "a" },35 { end: 2.15, start: 1.8, text: "single" },36 { end: 2.7, start: 2.15, text: "frame." },37 { end: 3.2, start: 3, text: "No" },38 { end: 3.9, start: 3.2, text: "timelines." },39 { end: 4.2, start: 4, text: "No" },40 { end: 4.5, start: 4.2, text: "drag" },41 { end: 4.65, start: 4.5, text: "and" },42 { end: 5.1, start: 4.65, text: "drop." },43 { end: 5.55, start: 5.3, text: "Just" },44 { end: 6, start: 5.55, text: "code." },45];4647const WORDS_PER_GROUP = 3;4849export const CaptionEditorialEmphasis = ({50 words = DEFAULT_WORDS,51 emphasisWords = ["single", "code."],52 color = "#f5f0d0",53 fontSize = 56,54 fontWeight = "400",55 emphasisScale = 2,56 background = "#0a0a0a",57 speed = 1,58 fps = 30,59 durationInFrames = 180,60 width = 1280,61 height = 720,62 className,63}: CaptionEditorialEmphasisProps) => {64 const safeSpeed = Math.max(0.01, speed);65 const durationMs = (durationInFrames / fps) * 1000;6667 const groups = [];68 for (let i = 0; i < words.length; i += WORDS_PER_GROUP) {69 const groupWords = words.slice(i, i + WORDS_PER_GROUP);70 groups.push({71 endMs: ((groupWords.at(-1)?.end ?? 0) * 1000) / safeSpeed + 180,72 startMs: (groupWords[0].start * 1000) / safeSpeed,73 words: groupWords,74 });75 }7677 const containerStyle: CSSProperties = {78 background,79 height,80 overflow: "hidden",81 position: "relative",82 width,83 };8485 return (86 <Timegroup87 className={className}88 duration={`${durationMs}ms`}89 mode="fixed"90 style={containerStyle}91 >92 <>93 <style>{`94 @keyframes framecn-cee-grp-in {95 from { opacity: 0; }96 to { opacity: 1; }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 |
