diff --git a/docs/examples.mdx b/docs/examples.mdx index a980c933d6..402972686d 100644 --- a/docs/examples.mdx +++ b/docs/examples.mdx @@ -1,274 +1,107 @@ --- -title: Examples -description: "Built-in examples for common video patterns. Hover to preview animations." +title: "Examples" +description: "Watch finished HyperFrames videos, inspect real production projects, or start from a working template." --- -Hyperframes includes starter examples to help you scaffold compositions quickly. Each example gives you a working project with the correct [composition structure](/concepts/compositions), [data attributes](/concepts/data-attributes), and a [GSAP timeline](/guides/gsap-animation) already wired up. +import { DocsVideo } from "/snippets/docs-video.jsx"; - - Looking for finished videos and production projects? Start with the [Showcase](/showcase). - +## Finished films -```bash Terminal +Each preview links to the complete source project. + +
+ + + + + + + + + + + +
+ +## One project, open end to end + +The same ten-second project the Quickstart builds. This is its actual render, +and the folder behind it is public — not a sealed demo. + +
+ +
+ + + Every file exactly as it renders — the composition, the caption overlay, the + measured word timings, and the brief the agent worked from. + + +## Start from a template + +Create a project with a working example: + +```bash npx hyperframes init my-video --example ``` -## Landscape Templates - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -## Portrait Templates - -
-
-
-
+| Example | Good starting point for | +| --------------- | -------------------------------------------- | +| `warm-grain` | Branding, lifestyle, and editorial work | +| `play-mode` | Energetic social videos and product launches | +| `swiss-grid` | Technical, structured, and corporate stories | +| `kinetic-type` | Type-led promos, intros, and title cards | +| `decision-tree` | Explainable diagrams and tutorials | +| `product-promo` | Multi-scene product showcases | +| `nyt-graph` | Editorial charts and data stories | +| `vignelli` | Bold portrait announcements | +| `blank` | Agent-generated or fully custom work | - Looking for a minimal starting point? Use **blank** — it gives you an empty composition with just the scaffolding, no visual design. - - ```bash Terminal - npx hyperframes init my-video --example blank - ``` + Choose a template for its structure and tone, then replace the sample content. If none fits, start + with `blank` and let the agent build from the brief. -## Choosing an Example +## Related topics -| Example | Style | Format | Best for | -|----------|-------|--------|----------| -| `warm-grain` | Organic, textured | Landscape | Lifestyle, branding, editorial | -| `play-mode` | Energetic, elastic | Landscape | Social media, product launches | -| `swiss-grid` | Clean, structured | Landscape | Corporate, data, technical | -| `kinetic-type` | Dramatic type | Landscape | Promos, intros, title cards | -| `decision-tree` | Diagrammatic | Landscape | Explainers, tutorials | -| `product-promo` | Multi-scene | Landscape | Product showcases, demos | -| `nyt-graph` | Editorial data | Landscape | Data stories, reports | -| `vignelli` | Bold, typographic | Portrait | Headlines, announcements | -| `blank` | Minimal scaffolding | — | Full control, agent-generated | - -## Example Details - - - - ### warm-grain - - Cream-toned aesthetic with grain texture overlay. - - **What it produces:** A composition with warm color grading, textured grain, and smooth transitions. Includes an intro sub-composition and captions support. - - ``` - my-video/ - ├── meta.json - ├── index.html - ├── compositions/ - │ ├── intro.html - │ ├── graphics.html - │ └── captions.html - └── assets/ - ``` - - - ### play-mode - - Playful elastic animations with bold, energetic motion. - - ``` - my-video/ - ├── meta.json - ├── index.html - ├── compositions/ - │ ├── intro.html - │ ├── stats.html - │ └── captions.html - └── assets/ - ``` - - - ### swiss-grid - - Structured grid layout inspired by Swiss/International Typographic Style. - - ``` - my-video/ - ├── meta.json - ├── index.html - ├── compositions/ - │ ├── intro.html - │ ├── graphics.html - │ └── captions.html - └── assets/ - ``` - - - ### vignelli - - Bold typography with red accents (1080×1920 portrait). - - ``` - my-video/ - ├── meta.json - ├── index.html - ├── compositions/ - │ ├── overlays.html - │ └── captions.html - └── assets/ - ``` - - - ### kinetic-type - - Bold kinetic typography promo with dramatic text animations. - - ``` - my-video/ - ├── meta.json - ├── index.html - └── compositions/ - └── main-graphics.html - ``` - - - ### decision-tree - - Animated flowchart with branching paths and progressive reveal. - - ``` - my-video/ - ├── meta.json - ├── index.html - └── compositions/ - └── decision_tree.html - ``` - - - ### product-promo - - Multi-scene product showcase with SVG assets. - - ``` - my-video/ - ├── meta.json - ├── index.html - ├── compositions/ - │ ├── scene1-logo-intro.html - │ ├── scene2-4-canvas.html - │ └── scene5-logo-outro.html - └── assets/ - ├── figma-cursors.svg - ├── figma-logo-pieces.svg - └── figma-logo-pills.svg - ``` - - - ### nyt-graph - - Animated data chart in print editorial style. - - ``` - my-video/ - ├── meta.json - ├── index.html - └── compositions/ - └── nyt-chart.html - ``` - - - ### blank - - Empty composition with just the scaffolding. - - ``` - my-video/ - ├── meta.json - ├── index.html - └── compositions/ - └── captions.html - ``` - - - -## Passing a Source Video - -```bash Terminal -npx hyperframes init my-video --example warm-grain --video ./my-clip.mp4 -``` - -The CLI will probe the video for duration, resolution, and codec. If the video uses an incompatible codec, it will be automatically transcoded to H.264 MP4 if FFmpeg is available. - -## Custom Examples - -Any directory with an `index.html` can serve as an example. Your custom example needs: - -1. An `index.html` with a [`data-composition-id`](/concepts/data-attributes#composition-attributes) root element -2. A [GSAP timeline](/guides/gsap-animation) registered in `window.__timelines` -3. Any assets in the same directory or a subdirectory - -```html index.html -
- - - - - -
-``` - -After creating a custom example, validate it with the [linter](/packages/cli#lint): - -```bash Terminal -npx hyperframes lint -``` - -## Next Steps - - - - Create, preview, and render your first video - - - Real production projects from HeyGen's launches — open-source for you to read and remix. - - - Add animations to your example - - - Understand the composition data model - - +- [Make your first video](/quickstart) +- [Choose a creation workflow](/workflows) +- [Take more control of an existing project](/go-further) diff --git a/docs/guides/4k-rendering.mdx b/docs/guides/4k-rendering.mdx index c5b08b9e26..9a0597d1c5 100644 --- a/docs/guides/4k-rendering.mdx +++ b/docs/guides/4k-rendering.mdx @@ -1,167 +1,70 @@ --- -title: 4K Rendering -description: "Render any composition to 4K (3840×2160) without rewriting it — the CLI supersamples a 1080p composition via Chrome's device scale factor." +title: Render in 4K +description: Author at 4K or supersample an existing composition at render time. --- -Hyperframes renders to 4K (3840×2160) two ways. Both produce a true 4K MP4; pick the one that matches your project. +## Render an existing project in 4K - - - Scaffold the project at 4K so the composition is laid out at 4K natively. Best when you want crisp 4K-native typography and assets. - ```bash - npx hyperframes init my-video --resolution 4k - ``` - - - Keep your existing 1080p composition. Pass `--resolution 4k` at render time and Chrome renders at 2× DPR so the screenshot lands at 4K. - ```bash - npx hyperframes render --resolution 4k --output 4k.mp4 - ``` - - - -## Quickstart - - - - ```bash Terminal - npx hyperframes render --resolution 4k --output my-video-4k.mp4 - ``` - - The composition's `data-width` / `data-height` are unchanged. Chrome's `deviceScaleFactor` is set to `2`, so the captured screenshot for each frame is 3840×2160. ffmpeg auto-detects the dimensions from the screenshot stream and encodes at 4K. - - - ```bash Terminal - npx hyperframes init my-video --resolution 4k - ``` - - Every scaffolded HTML file is patched in place: `data-width="3840"`, `data-height="2160"`, `data-resolution="landscape-4k"`, `#stage` CSS dimensions, and the `` tag. - - - ```bash Terminal - ffprobe -v error -select_streams v:0 -show_entries stream=width,height my-video-4k.mp4 - ``` - - Expected: - ``` - width=3840 - height=2160 - ``` - - - -## Resolution presets - -`--resolution` accepts these values on both `init` and `render`: - -| Preset | Dimensions | Aliases | -|--------|-----------|---------| -| `landscape` | 1920×1080 | `1080p`, `hd` | -| `portrait` | 1080×1920 | `1080p-portrait` | -| `square` | 1080×1080 | `1080p-square`, `square-1080p` | -| `landscape-4k` | 3840×2160 | `4k`, `uhd` | -| `portrait-4k` | 2160×3840 | `4k-portrait` | -| `square-4k` | 2160×2160 | `4k-square` | - -Examples: - -```bash Terminal -npx hyperframes render --resolution 4k # landscape 4K -npx hyperframes render --resolution portrait-4k # vertical 4K (TikTok / Reels at max quality) -npx hyperframes render --resolution 1080p # explicit 1080p (no-op on 1080p compositions) +```bash +npx hyperframes render --resolution 4k --output final-4k.mp4 ``` -## How `--resolution` works (supersampling) +HyperFrames keeps the composition's layout unchanged and captures it at a higher device-pixel ratio. A 1920×1080 composition becomes a 3840×2160 file. -The composition stays at its authored dimensions. Hyperframes computes a `deviceScaleFactor` from the ratio of output to composition dimensions and passes it to Chrome: +Use the matching preset for portrait or square work: -| Composition | `--resolution` | `deviceScaleFactor` | Output | -|-------------|---------------|--------------------|--------| -| 1920×1080 | `4k` | 2 | 3840×2160 | -| 1080×1920 | `portrait-4k` | 2 | 2160×3840 | -| 3840×2160 | `4k` | 1 (no-op) | 3840×2160 | +| Preset | Output | +| --- | --- | +| `4k` or `landscape-4k` | 3840×2160 | +| `portrait-4k` | 2160×3840 | +| `square-4k` | 2160×2160 | -Chrome then renders the page at the higher DPR — effectively rendering each CSS pixel as 2×2 device pixels — so the captured screenshot is at the requested resolution. +## Author a project at 4K - - This approach is intentionally simple — no composition edits, no second authoring pass. The tradeoff: 4K renders take roughly 4× as long per frame because there are 4× the pixels to capture and encode. - +If the project should use a 4K canvas from the start: -## What scales, what doesn't +```bash +npx hyperframes init my-video --resolution 4k +``` -Supersampling re-renders the page at higher DPR. That genuinely helps anything the browser rasterizes from a vector or high-resolution source, and does nothing for content already locked to a fixed pixel grid. Knowing which is which sets correct expectations before a 4K render: +Choose this when canvas or WebGL code, fixed-resolution media, or layout decisions need to know the final pixel dimensions while you author. -| Asset type | Behavior at `--resolution 4k` | -|------------|------------------------------| -| Text (HTML, SVG ``, web fonts) | ✅ **Re-rasterized at 4K.** Glyphs are vector and the browser shapes/rasterizes them at the new DPR. Crisp at any scale. | -| SVG / vector graphics | ✅ **Re-rasterized at 4K.** Same story as text — paths are vector. | -| CSS shapes, gradients, borders, shadows | ✅ **Re-rasterized at 4K.** Browser-generated raster. | -| Images with intrinsic dimensions ≥ 4K | ✅ **Full benefit.** A 3840×2160 source serves all the detail. | -| Images smaller than 4K (e.g. a 1920×1080 PNG) | ⚠️ **No new detail.** Browser upscales the source bitmap; output is no sharper than rendering at 1080p and upscaling externally — but no worse either. | -| `