programmatic video rendering framework that is actually fast
fix: Docs.rs build (#149)
Dmitriy Kovalenkoc78ffb93b375
diff --git a/.github/workflows/main.yml b/.github/workflows/main.ymlindex eb9dc43a..5c7f043f 100644--- a/.github/workflows/main.yml+++ b/.github/workflows/main.yml@@ -193,6 +193,43 @@ jobs:- name: Check examples wasm buildrun: just check-examples+ # docs.rs builds in this image without network access, so FFmpeg cannot be compiled from+ # source there; the [package.metadata.docs.rs] tables switch fframes-media to the FFmpeg+ # headers of the image instead. `cargo docs-rs` runs the rustdoc invocation of docs.rs from+ # that metadata. The second step documents the same crates with warnings as errors, so a+ # broken intra-doc link or an unparsable example fails the build here and not on docs.rs.+ docs:+ name: Build docs like docs.rs+ runs-on: ubuntu-latest+ container: ghcr.io/rust-lang/crates-build-env/linux:latest+ env:+ CARGO_INCREMENTAL: 0+ CARGO_PROFILE_DEV_DEBUG: 0+ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - uses: dtolnay/rust-toolchain@nightly++ - uses: Swatinem/rust-cache@v2+ with:+ key: docs+ save-if: ${{ github.ref == 'refs/heads/main' }}++ - name: Install cargo-docs-rs+ run: cargo install --locked cargo-docs-rs++ - name: Build docs with the docs.rs invocation+ run: |+ cargo docs-rs -p fframes-media+ cargo docs-rs -p fframes++ - name: Fail on rustdoc warnings+ env:+ RUSTFLAGS: --cfg fframes_docsrs+ RUSTDOCFLAGS: --cfg docsrs -D warnings+ run: cargo doc --no-deps -p fframes-media -p fframes --features fframes/cli,fframes/compile-time-svgtree,fframes/exif+release:# A push to main publishes a nightly, a v* tag publishes that version (scripts/release-version.sh)name: Publish releasediff --git a/fframes-editor-controller/Cargo.toml b/fframes-editor-controller/Cargo.tomlindex 9574dd58..897bf066 100644--- a/fframes-editor-controller/Cargo.toml+++ b/fframes-editor-controller/Cargo.toml@@ -26,3 +26,7 @@ getrandom = { version = "0.2.15", features = ["js"] }unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)',] }++# See fframes-media/Cargo.toml: docs.rs cannot build FFmpeg from source.+[package.metadata.docs.rs]+rustc-args = ["--cfg", "fframes_docsrs"]diff --git a/fframes-media/Cargo.toml b/fframes-media/Cargo.tomlindex aacc5d39..07b0aa75 100644--- a/fframes-media/Cargo.toml+++ b/fframes-media/Cargo.toml@@ -34,7 +34,13 @@ libc = "0.2.159"# FFmpeg is compiled from source and linked statically everywhere except Windows, where# building it needs an MSYS2 + MSVC toolchain. There it is linked from a prebuilt# FFmpeg 9 distribution found through FFMPEG_DIR or vcpkg (see README).-[target.'cfg(not(any(target_arch = "wasm32", windows)))'.dependencies]+#+# `fframes_docsrs` is set by the docs.rs build (see [package.metadata.docs.rs] below). docs.rs has no+# network access, so the from-source build is skipped there and ffmpeg-sys-next falls back to+# the FFmpeg headers of the docs.rs image through pkg-config. It is a project cfg on purpose:+# `--cfg docsrs` in RUSTFLAGS would also reach every dependency, and some enable removed+# nightly features under it.+[target.'cfg(not(any(target_arch = "wasm32", windows, fframes_docsrs)))'.dependencies]ffmpeg-sys-fframes = { workspace = true, features = ["build", "static"] }[features]@@ -65,7 +71,11 @@ libav-agree-gpl = ["ffmpeg-sys-fframes/build-license-gpl"]libav-agree-nonfree = ["ffmpeg-sys-fframes/build-license-nonfree"]libav-agree-version3 = ["ffmpeg-sys-fframes/build-license-version3"]+[package.metadata.docs.rs]+rustc-args = ["--cfg", "fframes_docsrs"]+[lints.rust]unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)',+ 'cfg(fframes_docsrs)',] }diff --git a/fframes-native-player/Cargo.toml b/fframes-native-player/Cargo.tomlindex 8890c7a9..72efaeb8 100644--- a/fframes-native-player/Cargo.toml+++ b/fframes-native-player/Cargo.toml@@ -29,3 +29,7 @@ audio = ["cpal"]# to the Skia CPU raster backend at runtime if the GPU backend can not be initialized.vulkan = ["fframes_skia_renderer/vulkan"]metal = ["fframes_skia_renderer/metal"]++# See fframes-media/Cargo.toml: docs.rs cannot build FFmpeg from source.+[package.metadata.docs.rs]+rustc-args = ["--cfg", "fframes_docsrs"]diff --git a/fframes-skia-renderer/Cargo.toml b/fframes-skia-renderer/Cargo.tomlindex 6072cdca..fca7b290 100644--- a/fframes-skia-renderer/Cargo.toml+++ b/fframes-skia-renderer/Cargo.toml@@ -38,3 +38,7 @@ wayland = ["skia-safe/wayland"]egl = ["skia-safe/egl"]# activate this feature to measure perforamnce and debug skiadebug = []++# See fframes-media/Cargo.toml: docs.rs cannot build FFmpeg from source.+[package.metadata.docs.rs]+rustc-args = ["--cfg", "fframes_docsrs"]diff --git a/fframes/Cargo.toml b/fframes/Cargo.tomlindex 374b4613..3d269e6c 100644--- a/fframes/Cargo.toml+++ b/fframes/Cargo.toml@@ -87,6 +87,13 @@ libav-agree-gpl = ["fframes-media/libav-agree-gpl"]libav-agree-nonfree = ["fframes-media/libav-agree-nonfree"]libav-agree-version3 = ["fframes-media/libav-agree-version3"]+[package.metadata.docs.rs]+# The codec and hardware features compile FFmpeg from source, which docs.rs cannot do (no+# network), so only the pure Rust features are documented. `--cfg fframes_docsrs` makes+# fframes-media link the FFmpeg headers of the docs.rs image instead of building FFmpeg.+features = ["cli", "compile-time-svgtree", "exif"]+rustc-args = ["--cfg", "fframes_docsrs"]+[lints.rust]unexpected_cfgs = { level = "warn", check-cfg = ['cfg(wasm_bindgen_unstable_test_coverage)',diff --git a/fframes/src/animation/animation.rs b/fframes/src/animation/animation.rsindex e65c2d86..229ce7da 100644--- a/fframes/src/animation/animation.rs+++ b/fframes/src/animation/animation.rs@@ -87,7 +87,7 @@ pub enum Easing {CubicBezier(f32, f32, f32, f32),// Inspired by https://webkit.org/demos/spring/spring.js. Copyright (C) 2016 Apple Inc. All rights reserved./// Specifies an animation that calculates value based on spring physics.- /// Learn more about spring physics: https://www.joshwcomeau.com/animation/a-friendly-introduction-to-spring-physics/+ /// Learn more about spring physics: <https://www.joshwcomeau.com/animation/a-friendly-introduction-to-spring-physics/>Spring {mass: f32,stiffness: f32,diff --git a/fframes/src/animation/cubic_bezier.rs b/fframes/src/animation/cubic_bezier.rsindex 77670a1f..e3b7bb12 100644--- a/fframes/src/animation/cubic_bezier.rs+++ b/fframes/src/animation/cubic_bezier.rs@@ -1,4 +1,4 @@-//! A port of https://github.com/gre/bezier-easing+//! A port of <https://github.com/gre/bezier-easing>//! by Gaëtan Renaudeau 2014 - 2015 – MIT License// These values are established by empiricism with tests (tradeoff: performance VS precision)diff --git a/fframes/src/animation/spring.rs b/fframes/src/animation/spring.rsindex 6c34ae0f..9e228aee 100644--- a/fframes/src/animation/spring.rs+++ b/fframes/src/animation/spring.rs@@ -48,7 +48,7 @@ impl SpringRuntime {1.0 - progress}- /// The dumbest way to calculate spring duration taken from animejs https://github.com/juliangarnier/anime/blob/master/src/index.js#L100+ /// The dumbest way to calculate spring duration taken from animejs <https://github.com/juliangarnier/anime/blob/master/src/index.js#L100>/// Not the best, but it looks there is no formula for precise calculation of spring dumping timing./// Must be called in compile timepub fn get_duration(&self) -> f32 {diff --git a/fframes/src/audio_window_functions.rs b/fframes/src/audio_window_functions.rsindex b7fa5b32..3f29dce7 100644--- a/fframes/src/audio_window_functions.rs+++ b/fframes/src/audio_window_functions.rs@@ -1,7 +1,7 @@use core::f32::consts::PI;use libm::cosf;-/// Applies a Hann window (https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows)+/// Applies a Hann window (<https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows>)/// to an array of samples.////// ## Return value@@ -17,7 +17,7 @@ pub fn hann_window(samples: &[f32]) -> Vec<f32> {windowed_samples}-/// Applies a Hamming window (https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows)+/// Applies a Hamming window (<https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows>)/// to an array of samples.////// ## Return valuediff --git a/fframes/src/color.rs b/fframes/src/color.rsindex bb8cc709..cabfac05 100644--- a/fframes/src/color.rs+++ b/fframes/src/color.rs@@ -84,7 +84,7 @@ impl Color {};/// The standard green chroma key color used in video production.- /// @see https://en.wikipedia.org/wiki/Chroma_key+ /// See <https://en.wikipedia.org/wiki/Chroma_key>pub const CHROMA_KEY: Color = Color {r: 0,g: 177,diff --git a/fframes/src/frame.rs b/fframes/src/frame.rsindex 15dc60f7..b51cc74d 100644--- a/fframes/src/frame.rs+++ b/fframes/src/frame.rs@@ -242,20 +242,20 @@ impl Frame {/// If font can not be resolved returns `None`.////// ```no_run- /// let options = &fframes::BreakLinesOpts {- /// // max width of the text content. Once line become wider it wraps.+ /// let font = fframes::FontQuery { family: "DM Sans", size: 26, weight: 400, ..Default::default() };+ /// let options = fframes::BreakLinesOpts {+ /// font,+ /// // max width of the text content. Once a line becomes wider it wraps./// width: 500,- /// // font family name resolved. Can be checked in the editor for resolved font file.- /// font_family: "Roboto",- /// // the x position of the text element- /// x: "100",- /// // the y position of the text element- /// y: "100",+ /// // position of the text element+ /// x: 100,+ /// y: 100,/// align: fframes::TextAlign::Center,+ /// fill: "#fff",/// ..Default::default()- /// });+ /// };///- /// let wrapped_text = frame.text_break_lines(&ctx, "Hello world", options);+ /// let wrapped_text = frame.text_break_lines_structure(ctx, "Hello world", options);/// ```////// Output of this function can be converted to svgr using `WrappedTextStructure::as_svgr`@@ -414,7 +414,7 @@ impl Frame {/// Besides text cue contains additional metadata like start/end time stamp,/// notes and cue settings which can be used to customise text.///- /// Read more about available data and cue setting at https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API+ /// Read more about available data and cue setting at <https://developer.mozilla.org/en-US/docs/Web/API/WebVTT_API>pub fn get_subtitle_cue<'a, TSubtitles: FFramesSubtitles<'a>>(&self,subtitles: &'a TSubtitles,diff --git a/fframes/src/lib.rs b/fframes/src/lib.rsindex e3c3f582..eb90a489 100644--- a/fframes/src/lib.rs+++ b/fframes/src/lib.rs@@ -1,3 +1,103 @@+//! fframes renders videos from Rust code. A video is a type that implements [`Video`]. It declares+//! the size, frame rate and duration once and returns an SVG tree ([`Svgr`]) for every frame from+//! the [`svgr!`] macro. The renderer rasterises the frames on all cores, mixes the audio and+//! encodes the result with FFmpeg.+//!+//! # Pipeline+//!+//! 1. [`Video::duration`], [`Video::define_scenes`] and [`Video::audio`] are resolved into a frame+//! timeline once per render. Scenes ([`Scene`], [`Scenes`], [`Overlap`]) are placed back to back,+//! audio tracks ([`AudioMap`], [`AudioTrack`]) are placed at their sample position.+//! 2. For every frame the renderer builds a [`Frame`] (index, time, scene offset) and a+//! [`FFramesContext`] (media lookups, scene info, video size) and calls+//! [`Video::render_frame`]. Frames are rendered concurrently, so the method must be pure: read+//! precomputed data from `self`, no I/O, no panics.+//! 3. The returned [`Svgr`] becomes a `usvgr::Tree`. With the `compile-time-svgtree` feature the+//! macro emits the tree at compile time and every subtree without `{}` interpolation carries a+//! static hash, which lets the backends cache its rasterisation across frames. Without the+//! feature the markup is a string parsed per frame.+//! 4. A rendering backend ([`FFramesRenderBackend`]) rasterises the tree. The built-in+//! [`cpu::CpuRenderingBackend`] renders one video segment per thread with tiny-skia. The Skia+//! backend in the `fframes_skia_renderer` crate walks the tree on the GPU and also executes+//! [`Shader`] layers.+//! 5. Segments are encoded through FFmpeg ([`EncoderOptions`]), concatenated, and muxed with the+//! audio mix ([`AudioMixOptions`]: summing, ducking, fades, master limiter).+//!+//! # Minimal video+//!+//! ```rust+//! use fframes::{AudioMap, Duration, FFramesContext, Frame, RenderOptions, Svgr, Video, animation::Easing};+//!+//! // Every file in the folder becomes a field; fonts are registered by family name.+//! fframes::include_media_dir!(pub struct Media, "media");+//!+//! struct Hello<'a> {+//! media: &'a Media,+//! title: &'a str,+//! }+//!+//! impl Video for Hello<'_> {+//! const FPS: usize = 30;+//! const WIDTH: usize = 1920;+//! const HEIGHT: usize = 1080;+//!+//! fn duration(&self) -> Duration<'_> {+//! Duration::Seconds(3.0)+//! }+//!+//! fn audio(&self) -> AudioMap<'_> {+//! AudioMap::none()+//! }+//!+//! fn render_frame<'a>(&'a self, frame: Frame, _ctx: &FFramesContext<'a, '_>) -> Svgr<'a> {+//! let opacity = frame.animate(&fframes::timeline!(+//! at 0.0 => 0.5, animate 0.0_f32 => 1.0, Easing::EaseOut+//! ));+//! fframes::svgr!(+//! <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 1080"+//! width={Self::WIDTH} height={Self::HEIGHT}>+//! <text x="120" y="560" font-family="DM Sans" font-size="150" fill="#fff"+//! opacity={opacity}>+//! "Hello " {self.title}+//! </text>+//! </svg>+//! )+//! }+//! }+//!+//! fn main() -> std::process::ExitCode {+//! let media = Media::prepare().expect("embedded media");+//! let video = Hello { media: &media, title: "world" };+//! // `render`, `frame`, `strip`, `inspect`, `snapshot`, `audio` and more (feature `cli`).+//! fframes::cli::new(&video, RenderOptions { media: Some(&media), ..Default::default() }).run()+//! }+//! ```+//!+//! Without the `cli` feature call [`render`] with the output path, a backend and [`RenderOptions`],+//! or render single frames through [`Previewer`].+//!+//! # Feature flags+//!+//! - `cpu_renderer` (default): the tiny-skia based [`cpu::CpuRenderingBackend`] and the encoding+//! pipeline. Disable it for a `wasm32` build.+//! - `cli`: the [`cli`] module and its `clap` dependency.+//! - `compile-time-svgtree`: [`svgr!`] builds the SVG tree at compile time and hashes static+//! subtrees. Required by the Skia backend and by [`Shader`].+//! - `exif`: EXIF orientation of loaded images.+//! - Codecs `h264`, `h265`, `aac`, `mp3lame`, `opus`, `vpx`: compile the library into the static+//! FFmpeg build. Some of them need `libav-agree-gpl`, `libav-agree-nonfree` or+//! `libav-agree-version3`, which state that you accept the corresponding FFmpeg license terms.+//! - Hardware acceleration `videotoolbox`, `audiotoolbox`, `vaapi`, `nvidia`, `qsv`, `vulkan`,+//! `mediacodec`: enable the platform encoders and decoders in FFmpeg.+//!+//! # FFmpeg+//!+//! Decoding, encoding and muxing use the FFmpeg libraries through `ffmpeg-sys-next`, re-exported+//! as [`ffmpeg_sys_fframes`]. On Linux and macOS FFmpeg is compiled from source during+//! `cargo build` and linked statically, so the toolchain listed in the repository README (nasm,+//! yasm, clang, the codec dev packages) must be installed. On Windows a prebuilt FFmpeg 9 is+//! linked through `FFMPEG_DIR` or vcpkg and the codec features are not available.+//!mod audio_analysis;mod audio_data;mod audio_map;diff --git a/fframes/src/media_provider.rs b/fframes/src/media_provider.rsindex bbeba34b..dc55c4e6 100644--- a/fframes/src/media_provider.rs+++ b/fframes/src/media_provider.rs@@ -24,7 +24,7 @@ pub trait MediaProvider<'a>: Send + Sync + Debug {fn resolve_video(&'a self, name: &str) -> Option<&'a media::VideoMedia>;/// Returns all the font data along with the original file name- /// fn populate_font_source(&'a self, font_source: &mut dyn FontSource) -> Result<Vec<RawFontData>>;+ /// `fn populate_font_source(&'a self, font_source: &mut dyn FontSource) -> Result<Vec<RawFontData>>;`fn populate_font_source(&'a self, font_source: &mut dyn FontSource);#[cfg(not(target_arch = "wasm32"))]fn populate_image_source(diff --git a/fframes/src/text.rs b/fframes/src/text.rsindex bb2a106f..984b7d95 100644--- a/fframes/src/text.rs+++ b/fframes/src/text.rs@@ -21,7 +21,7 @@ pub enum TextAlign {#[derive(Debug, Clone, Copy, Hash)]/// Define a query that will resolve a font from the provided media source.-/// The values from the struct could be passed directly to the <text> element attributes like:+/// The values from the struct could be passed directly to the `<text>` element attributes like:////// ```no_run/// let font = FontQuery {diff --git a/fframes/src/video.rs b/fframes/src/video.rsindex bdd8214b..404dc60d 100644--- a/fframes/src/video.rs+++ b/fframes/src/video.rs@@ -32,30 +32,31 @@ pub trait Video: Sync + Sized {/// In short: put your scenes to the `&self` or do not add any fields to the scene struct.////// # Example- /// ```rust- /// use fframes::{Video, Scenes, Scene, Frame, Svgr, FFramesContext};+ /// ```no_run+ /// use fframes::{Scene, Scenes, Video};///- /// struct SceneZeroSize;- /// struct SceneWithInput {- /// value: String;+ /// #[derive(Debug)]+ /// struct Intro;+ /// #[derive(Debug)]+ /// struct Chapter {+ /// title: String,/// }///- /// impl Scene For SceneZeroSize { ... }- /// impl Scene For SceneWithInput { ... }+ /// impl Scene for Intro { /* duration, render_frame */ }+ /// impl Scene for Chapter { /* duration, render_frame */ }////// struct MyVideo {- /// scene_with_input: SceneWithInput,- /// };+ /// chapter: Chapter,+ /// }////// impl Video for MyVideo {/// fn define_scenes(&self) -> Scenes<'_> {/// let scenes: Vec<&dyn Scene> = vec![- /// // notice this is a zero sized type so we can create ref right here- /// &SceneZeroSize},- /// // And here we passing a ref bound to the &self- /// &self.scene_with_input,- /// ]- ///+ /// // a zero sized type, so the reference can be created right here+ /// &Intro,+ /// // a scene with data is borrowed from `self`+ /// &self.chapter,+ /// ];/// Scenes::from(scenes)/// }/// }diff --git a/skills/fframes-video/SKILL.md b/skills/fframes-video/SKILL.mdindex 996c234d..1729f507 100644--- a/skills/fframes-video/SKILL.md+++ b/skills/fframes-video/SKILL.md@@ -56,11 +56,13 @@ Options: `--template single-scene|multi-scene`, `--format landscape|portrait|squmatches the installed `cargo-fframes`; `--git` uses the repository's `main` branch instead. Always pass `--yes` so nothing waits for input.Templates:-- `single-scene` (default): one scene with a greeting that springs in over a moving glow. It- adapts to every format; start here for single-shot clips, title cards and portrait video.-- `multi-scene`: two scenes (a product announcement and an animated chart) on a 16:9 grid,- with a shared footer and progress bar. Start here for anything with several scenes; it only- accepts `landscape` and `uhd`.+- `single-scene` (default): one scene. It adapts to every format; start here for single-shot+ clips, title cards and portrait video.+- `multi-scene`: two scenes. Start here for anything with several scenes; it only accepts+ `landscape` and `uhd`.++The template content is placeholder code that shows the API. Replace its layout, colors,+fonts and decorations with a design made for the video the user asked for.**Use the Skia GPU backend (the default).** `cargo fframes new` picks Skia on Metal (macOS) orVulkan (Linux, Windows). It renders about 10x faster than the CPU backend and gives you the@@ -80,7 +82,7 @@ The project renders as generated:my-video/src/lib.rs # the video (from the template)src/main.rs # the command line- media/ # fonts, images and audio compiled into the binary (DM Sans to start)+ media/ # fonts, images and audio compiled into the binary (one starter font)tests/frames.rs # frame snapshots and a check of every frame for problemsREADME.md # the commands below```@@ -171,7 +173,7 @@ impl Video for MyVideo<'_> {fn define_scenes(&self) -> Scenes<'_> { Scenes::from(vec![&self.intro as &dyn Scene, &self.main]) }fn render_frame<'a>(&'a self, frame: Frame, ctx: &FFramesContext<'a, '_>) -> Svgr<'a> {fframes::svgr!(<svg xmlns="http://www.w3.org/2000/svg" width={Self::WIDTH} height={Self::HEIGHT}>- <rect width={Self::WIDTH} height={Self::HEIGHT} fill="#0b1020" />+ <rect width={Self::WIDTH} height={Self::HEIGHT} fill={BACKGROUND} />{ctx.render_scenes(&frame)}</svg>)}@@ -205,7 +207,7 @@ The short version of `references/design.md`:200-300 ms. Related items stagger by 60-120 ms. Give the viewer 1-2 s to read after themotion settles, and never move everything at once.- Cross-fade scenes (`fn overlap(&self) -> Overlap { Overlap::Previous(0.4) }`) or carry an- element across the cut. A slow background drift keeps holds from looking frozen.+ element across the cut. Keep a little motion during holds so they do not look frozen.- At 1920x1080: titles 96-140 px, body 44-60 px, at most about 8 words per line and 3 lines percard. Portrait 1080x1920 is watched on a phone: same pixel sizes or larger, content insidethe middle 80% because platform UI covers the top and bottom.diff --git a/skills/fframes-video/references/design.md b/skills/fframes-video/references/design.mdindex 085f3f88..f61d1d44 100644--- a/skills/fframes-video/references/design.md+++ b/skills/fframes-video/references/design.md@@ -11,7 +11,7 @@ problems already looks finished.- Scene lengths: title 2.5-4 s, content 4-8 s, outro 2-3 s. Social clips: first frame mustalready show something (no fade from black) and the hook lands in the first 1.5 s.- Entrances take 0.3-0.6 s, exits 0.2-0.3 s. Holds (nothing moves) of 1-3 s are good; keep a- slow background drift so they do not look frozen.+ little motion somewhere so they do not look frozen.- Sync cuts and entrances to the beat or the voice (see audio.md).## Layout@@ -26,8 +26,7 @@ problems already looks finished.## Typography- One family (two at most: a display face for titles, a text face for body). Ship the files- in `media/`. Good free choices: Inter, DM Sans, Manrope, Space Grotesk (UI/tech), Playfair- Display / Fraunces (editorial), JetBrains Mono (code), Bebas Neue (condensed display).+ in `media/` and check they contain every glyph the text uses.- Sizes at 1920x1080: hero 140-200, title 96-120, subtitle 44-56, body 44-60, caption 28-34.Never below 28 px. Portrait at 1080 wide uses about the same pixel sizes.- Weights: title 600-800, body 400-500. Letter-spacing: `-1` to `-3` for big titles,@@ -39,15 +38,10 @@ problems already looks finished.## Color-- A background, a foreground (text), one accent, one or two supporting tints. Example sets:- - Light: bg `#f8fafc`, text `#0f172a`, muted `#475569`, accent `#6366f1`, tint `#c7d2fe`.- - Dark: bg `#0b1020`, text `#e2e8f0`, muted `#94a3b8`, accent `#22d3ee`, tint `#1e293b`.- - Warm: bg `#fff7ed`, text `#1c1917`, accent `#ea580c`, tint `#fed7aa`.+- A background, a foreground (text), one accent, one or two supporting tints.- Contrast: body text at least 4.5:1 against its background. Check suspicious frames at fullsize.-- Depth without effects: a large soft radial gradient behind content, slightly different- surface color for cards, a 1-2 px border of a lighter tint. Blur and drop shadow filters are- expensive on the CPU backend; keep them on static subtrees (no `{}` inside) so they are+- Blur and drop shadow filters are expensive on the CPU backend; keep them on static subtrees (no `{}` inside) so they arecached, or use the Skia backend.## Motion@@ -94,7 +88,7 @@ Counter ("0 -> 12,480"): animate an `f32` with `EASE_OUT_EXPO` over 1.2-1.8 s anthousands separators; use a font with tabular figures (or a monospace font) so digits do notjiggle, and right-align it with `text-anchor="end"`.-Progress / highlight bar: animate a `<rect>` width from a hairline (`0.5`, never `0`, SVG+Growing bar (charts, highlights): animate a `<rect>` width from a hairline (`0.5`, never `0`, SVGrejects zero sized rects) to its target with `EASE_IN_OUT`.Underline or stroke draw-on: `stroke-dasharray={len}` and animate `stroke-dashoffset` from@@ -107,9 +101,6 @@ outgoing scene -80 px while the incoming comes from +80 px.Lower third: a bar slides in from the left (`EASE_OUT_EXPO`, 0.5 s), the name fades up 0.15 slater, the role 0.1 s after that, holds, then everything exits together in 0.25 s.-Background life: two large blurred radial gradients (static markup inside a `<g>`) whose-wrapping transforms drift 50-150 px over 8-12 s with `animate_loop`.-## Review checklistRun `strip` for every scene and `frame` for the key moments, then check: