pub struct Animation {
pub frames: Vec<Rendered>,
}Expand description
A sequence of rendered frames.
Fields§
§frames: Vec<Rendered>Implementations§
Source§impl Animation
impl Animation
Sourcepub fn sweep(
count: usize,
width: u32,
height: u32,
build: impl Fn(f64) -> ViewHandle,
) -> Self
pub fn sweep( count: usize, width: u32, height: u32, build: impl Fn(f64) -> ViewHandle, ) -> Self
Render count frames, asking build for the view at each step.
t runs from 0.0 to 1.0 inclusive, so the caller expresses the animation
as a pure function of progress. That keeps capture deterministic: no
wall-clock, no run loop, and the same frames every run and on both sides
of a parity comparison.
Sourcepub fn sweep_with(
count: usize,
width: u32,
height: u32,
via_image_renderer: bool,
build: impl Fn(f64) -> ViewHandle,
) -> Self
pub fn sweep_with( count: usize, width: u32, height: u32, via_image_renderer: bool, build: impl Fn(f64) -> ViewHandle, ) -> Self
As Animation::sweep, but choosing the capture path.
Filter effects — blur, saturation, brightness, contrast, grayscale — and
Metal shaders do not execute through cacheDisplayInRect; capturing an
animation of one that way yields frames that are all identical.
Sourcepub fn diff_count(&self, other: &Animation, tolerance: u8) -> u32
pub fn diff_count(&self, other: &Animation, tolerance: u8) -> u32
Total pixels differing from other, summed over frames.
u32::MAX if the frame counts differ.
Sourcepub fn frame_deltas(&self) -> Vec<u32>
pub fn frame_deltas(&self) -> Vec<u32>
Per-frame change: how many pixels differ between consecutive frames.
An animation whose frames are all identical is not animating, however well-formed the file is.
Sourcepub fn write_filmstrip(&self, path: &str) -> bool
pub fn write_filmstrip(&self, path: &str) -> bool
Write the frames tiled left-to-right as one still image.
An APNG only animates in a viewer that supports it — most macOS previews show frame one and stop — so a filmstrip is the version that is legible anywhere.