Skip to main content

Animation

Struct Animation 

Source
pub struct Animation {
    pub frames: Vec<Rendered>,
}
Expand description

A sequence of rendered frames.

Fields§

§frames: Vec<Rendered>

Implementations§

Source§

impl Animation

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn write_apng(&self, path: &str, delay_ms: u16) -> Result<()>

Write the frames as an animated PNG.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.