Expand description
Capture HTML/CSS/JS animations as a deterministic, transparent PNG sequence.
Renders a page frame by frame in chrome-headless-shell with virtual time and an injected frame clock, so every run gives byte-identical frames.
Two capture modes:
begin-frame(Linux): Chrome only draws when we issueHeadlessExperimental.beginFrame, which also returns the screenshot.screenshot(macOS and Windows, where BeginFrame is unsupported or unreliable): the frame clock shim runs rAF callbacks itself, thenPage.captureScreenshot.
§As a library
capture calls back with each frame (async). png_stream runs a capture
on its own thread and returns a std::io::Read of PNG files back to back,
which is exactly what aether_renderer_core::render_stream reads:
use aether_renderer_capture::{png_stream, CaptureOptions};
let opts = CaptureOptions::new("anim.html", "/path/to/chrome-headless-shell")
.size(1080, 1080)
.fps(30)
.duration_secs(4.0);
let frames = opts.frame_count();
let (stream, capture) = png_stream(opts)?;
// aether_renderer_core::render_stream(cfg, stream, Some(frames as u32), |p| { ... })?;
let report = capture.wait()?;Modules§
- sink
- Where captured frames go: a folder, a ZIP, or stdout.
Structs§
- Capture
Handle - The capture thread behind a
PngStream. - Capture
Options - What to capture and how.
- Capture
Report - What a finished capture did.
- PngStream
- PNG files back to back, produced by a capture running on another thread.
See
png_stream.
Enums§
- Mode
- How frames are drawn and grabbed.
Functions§
- capture
- Capture
opts, callingon_frame(index, png)for every frame in order. - png_
stream - Run a capture on its own thread and read it as a PNG stream (PNG files back
to back), e.g. for
aether_renderer_core::render_stream.