Skip to content

zenstory-ai/drama-skills / skills/short-drama-edit

short-drama-edit

Verified

将已生成的短剧镜头与配音剪成成片,编写剪辑单并完成渲染验收。用于“剪成成片/套剪”“加字幕/画面文字”“统一响度”“调整成片剪辑节奏、配乐/字幕混音与渲染导出”或导出精修素材;需补素材或改故事时转回上游阶段。

assets/remotion/src/Subtitles.tsx

View on GitHub
import React from "react";
import { AbsoluteFill, spring, useCurrentFrame, useVideoConfig } from "remotion";
import { Cue } from "./schema";
import { assertFamilyResolves } from "./font";
import { lineEms } from "./rules.mjs";
import { SANS, SUBTITLE } from "./screen/tokens";

/** Splits a line into plain and highlighted runs, earliest keyword first. */
const runs = (text: string, keys: string[]): { text: string; key: boolean }[] => {
  const out: { text: string; key: boolean }[] = [];
  let rest = text;
  while (rest) {
    const hit = keys
      .map((key) => ({ key, at: rest.indexOf(key) }))
      .filter((found) => found.at >= 0)
      .sort((a, b) => a.at - b.at)[0];
    if (!hit) {
      out.push({ text: rest, key: false });
      break;
    }
    if (hit.at) out.push({ text: rest.slice(0, hit.at), key: false });
    out.push({ text: hit.key, key: true });
    rest = rest.slice(hit.at + hit.key.length);
  }
  return out;
};

/**
 * The subtitle layer: Noto Sans SC 900, white or voice-coloured fill over a
 * dark rim drawn beneath it, baseline about a quarter up the frame so the
 * platform's own UI never covers it. Sizes are fractions of frame height.
 */
export const Subtitles: React.FC<{ cues: Cue[] }> = ({ cues }) => {
  const frame = useCurrentFrame();
  const { fps, height, width } = useVideoConfig();
  const matched = cues
    .map((item) => ({
      cue: item,
      startFrame: Math.round(item.start * fps),
      endFrame: Math.round(item.end * fps),
    }))
    .find((entry) => frame >= entry.startFrame && frame < entry.endFrame);
  const cue = matched?.cue;
  // Checked against a line about to be filmed, so a missing face stops the
  // render on the first subtitle frame rather than after the whole pass.
  assertFamilyResolves(SANS, cue?.text ?? "");
  if (!matched || !cue) return null;

  const u = height / 100;
  // One line: long lines are split upstream; what still does not fit shrinks.
  const size = Math.min(u * 4.3, (width * 0.9) / (lineEms(cue.text) * 1.04));
  const ageFrames = frame - matched.startFrame;
  const age = ageFrames / fps;
  const pop = spring({ frame: ageFrames, fps, config: { damping: 12, stiffness: 260, mass: 0.5 } });
  return (
    <AbsoluteFill style={{ justifyContent: "flex-end", alignItems: "center", paddingBottom: u * 24 }}>
      <div
        style={{
          fontFamily: SANS,
          fontWeight: 900,
          fontSize: size,
          color: SUBTITLE.fill[cue.kind],
          letterSpacing: size * 0.04,
          textAlign: "center",
          lineHeight: 1.2,
          whiteSpace: "nowrap",
          WebkitTextStroke: `${u * 0.42}px ${SUBTITLE.rim}`,
          paintOrder: "stroke fill",
          textShadow: `0 ${u * 0.25}px ${u * 0.6}px rgba(0,0,0,0.55)`,
          opacity: Math.min(1, age / 0.06),
          transform: `scale(${0.94 + 0.06 * pop})`,
        }}
      >
        {runs(cue.text, cue.keys).map((run, index) =>
          run.key ? (
            <span
              key={index}
              style={{
                color: SUBTITLE.keyword,
                display: "inline-block",
                // A 120 ms pop as the word lands.
                transform: `scale(${1.08 + 0.15 * Math.max(0, 1 - age / 0.12)})`,
              }}
            >
              {run.text}
            </span>
          ) : (
            <span key={index}>{run.text}</span>
          ),
        )}
      </div>
    </AbsoluteFill>
  );
};
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall