Skip to content

feat(droid-control): code annotations + transition styles#23

Open
factory-ain3sh wants to merge 3 commits intomasterfrom
droid/post-processing-v1
Open

feat(droid-control): code annotations + transition styles#23
factory-ain3sh wants to merge 3 commits intomasterfrom
droid/post-processing-v1

Conversation

@factory-ain3sh
Copy link
Copy Markdown
Contributor

@factory-ain3sh factory-ain3sh commented Apr 20, 2026

Description

Adds two opt-in props to the droid-control Remotion Showcase composition: codeAnnotations (timed, syntax-highlighted code cards rendered above the captured clip) and transitionStyle (selects between motion-blur, flash, whip-pan, light-leak, glitch-lite for the title→content and content→outro crossfades). Both default to current behavior so existing callers render byte-equivalent output.

The annotation overlay is implemented natively against prism-react-renderer (palette-aware vsDark theme, line highlight + focus dimming, anchorable to top-right / center / bottom-left). The transition resolver replaces the hardcoded motionBlurTransition() constant with getTransitionPresentation(style, palette) and ships five Remotion-native presentations — no external transition framework or shader/WebGL pipeline introduced. The orphaned MotionBlurTransition.tsx is removed since ShowcaseTransition.tsx now owns the motion-blur presentation alongside the four new variants.

Related Issue

N/A — no Linear ticket.

Potential Risk & Impact

  • Behavioral change for existing renders: none. Both new props are optional; transitionStyle defaults to motion-blur (same code path as before, now living in ShowcaseTransition.tsx), and codeAnnotations is unset/empty by default. Three fixture renders confirmed identical 9.5s 1920×1080 H.264 output for the no-prop case.
  • New runtime dependency: prism-react-renderer@^2.4.1 is added to plugins/droid-control/remotion. It is a popular, dependency-light Prism wrapper (3 packages added per npm install). No security advisories at the pinned version. Recorded in NOTICES.md.
  • Attribution: the transitionStyle enum names (whip-pan, light-leak, flash, glitch-lite) and the "selectable enum of named transitions" API shape were shaped by @hyperframes/shader-transitions (Apache-2.0). Implementations are original Remotion-native CSS/SVG overlays — no GLSL/WebGL involved. Credited in NOTICES.md and in a header comment on ShowcaseTransition.tsx.
  • Schema additions in lib/schema.ts: codeAnnotationSchema, codeRangeSchema, transitionStyleSchema. These extend showcaseSchema with optional fields, so existing props validate unchanged.
  • MotionBlurTransition.tsx deleted. It was no longer imported anywhere in src/ after the resolver wiring landed; verified via ripgrep.
  • Defensive runtime parsing: codeAnnotations defaults declared in zod (highlight: [], focus: [], language: 'tsx', position: 'top-right') are not applied by Remotion when props arrive via --props= JSON, so the overlay reads them with ?? defaults to avoid undefined access at render time.
  • Skill doc surface: compose/SKILL.md gains 31 lines (2 props-table rows + tight schema table + 5-row transition style table); showcase/SKILL.md gains 14 lines (preset×style matching table + a one-line bullet update). Both new sections in showcase/SKILL.md explicitly redirect to compose/SKILL.md for schema details to avoid duplication. Top-level README.md gets a one-line update; ARCHITECTURE.md gains a "Composition surface" subsection.
  • Layout default corrected (follow-up commit). Previously the skill guidance tipped droids toward side-by-side with BEFORE/AFTER labels as the default shape, even on brand-new features where no "before" exists. droid-control/SKILL.md now has a "Layout default" table calling out single as the default and gating side-by-side to real comparison flows (regression, behavior-preserving refactor, explicit user request). compose/SKILL.md's primary JSON example renders a single clip; a one-line note shows the side-by-side variant. No schema change — layoutSchema already supported both.
  • Render pipeline / render-showcase.sh: untouched. Existing staging/duration/cleanup behavior preserved.

How Has This Been Tested?

  • npx tsc --noEmit clean in plugins/droid-control/remotion/.
  • Three end-to-end fixture renders via scripts/render-showcase.sh against a synthetic 3s testsrc2 mp4:
    1. Default props (no transitionStyle, no codeAnnotations) — regression check, motion-blur path.
    2. transitionStyle: "whip-pan" + one codeAnnotation with highlight range, top-right anchor — exercises both new code paths.
    3. transitionStyle: "flash" with factory preset — exercises the warm-flash overlay branch.
  • All three outputs verified via ffprobe: 1920×1080, H.264 (yuvj420p), 9.5s duration (matches 4s title + 3s clip + 3.5s outro − 2×0.5s transitions).
  • A still frame at the annotation peak confirmed: syntax-highlighted TSX with line numbers, accent-tinted highlight band on the targeted line range, file-path caption, palette + watermark intact, captured clip visible underneath.
  • Caught one Rules-of-Hooks violation (early return null before useMemo) and one undefined-array crash during fixture rendering; both fixed and re-validated before commit.

@factory-ain3sh factory-ain3sh self-assigned this Apr 20, 2026
@factory-ain3sh factory-ain3sh added the enhancement New feature or request label Apr 20, 2026
Add an opt-in `codeAnnotations` layer and a `transitionStyle` resolver to
the Remotion Showcase composition. Defaults are unchanged so existing props
render identically; the new behavior only activates when those props are set.

- Schema: `codeAnnotationSchema` (t, dur, code, language, title, highlight,
  focus, position) and `transitionStyleSchema` (motion-blur, flash, whip-pan,
  light-leak, glitch-lite).
- CodeAnnotationOverlay: syntax-highlighted code cards via prism-react-renderer
  with palette-aware theming, line highlights, focus dimming, and enter/exit
  animation. Anchored top-right by default.
- ShowcaseTransition: five Remotion-native transition presentations wired via
  `getTransitionPresentation(style, palette)`. Motion-blur preserves the
  existing look; the others are palette-aware (warm on Factory presets).
- Docs: compose/SKILL.md gains authoring guidance and a full props reference
  for both features; showcase/SKILL.md adds preset-level style guidance.
  README and ARCHITECTURE.md updated to reflect the new composition surface.

Validated: `tsc --noEmit` clean; three fixture renders (default, whip-pan +
code annotation, flash) produce 9.5s 1920x1080 H.264 mp4s with expected
content.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
factory-droid bot added 2 commits April 20, 2026 04:59
…m-react-renderer

The transitionStyle taxonomy ('whip-pan', 'light-leak', 'flash', 'glitch-lite')
and the 'selectable enum of named transitions' API shape are inspired by
@hyperframes/shader-transitions (Apache-2.0). Implementations are still
original Remotion-native CSS/SVG overlays.

Also adds prism-react-renderer (MIT) to the runtime dependency list since it
ships with the new CodeAnnotationOverlay.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…e to real comparisons

The skill guidance was tipping droids toward before/after side-by-side as the
canonical video shape — primary JSON example used side-by-side with BEFORE/AFTER
labels, Demo-mode goal was phrased as 'before/after comparison', delegation
table led with 'Capture before branch / Capture after branch'. Result: droids
were reaching for side-by-side even on brand-new features where there is no
meaningful 'before', sometimes synthesizing a fake baseline.

Fix (guidance only, no schema change — layoutSchema already supports both):

- droid-control/SKILL.md: new 'Layout default' table under Workflow shape
  calling out single as the default with the specific cases that warrant
  side-by-side. Explicit 'do not synthesize a before' rule.
- droid-control/SKILL.md: delegation table collapses the two pre-framed
  before/after rows into 'Capture clip' (single) + 'Capture both clips'
  (comparison). Parallel capture section heading/gate updated to read
  'comparison flows only'.
- compose/SKILL.md: primary JSON example now renders a single clip with
  labels: []. One-line note shows how to flip to side-by-side when a real
  comparison exists. Showcase-vs-Demo 'Goal' cell no longer pre-supposes
  before/after.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant