Builder

Type Alias Builder 

Source
pub type Builder = RefHandle<skottie_Animation_Builder>;
Expand description

A builder for creating Animation instances with custom configuration.

The builder allows setting a resource provider for loading external assets, a font manager for text rendering, and various flags to control animation loading.

§Example

use skia_safe::skottie::Builder;

let json = r#"{"v":"5.5.7","fr":30,"ip":0,"op":60,"w":200,"h":200,"layers":[]}"#;
let animation = Builder::new().make(json);

Aliased Type§

pub struct Builder(/* private fields */);

Implementations§

Source§

impl Builder

Source

pub fn new() -> Self

Create a new animation builder with default settings.

Source

pub fn with_flags(flags: BuilderFlags) -> Self

Create a new animation builder with the specified flags.

Source

pub fn set_font_manager(self, font_mgr: FontMgr) -> Self

Set the font manager to use for text rendering.

Consumes and returns self for method chaining.

Source

pub fn set_resource_provider( self, provider: impl Into<NativeResourceProvider>, ) -> Self

Set the resource provider for loading external assets.

The resource provider is used to load images, fonts, and other external resources referenced by the animation.

Consumes and returns self for method chaining.

Source

pub fn make(self, json: impl AsRef<str>) -> Option<Animation>

Build an animation from a JSON string.

Returns None if the JSON cannot be parsed as a valid Lottie animation.

Source

pub fn make_from_file(self, path: impl AsRef<Path>) -> Option<Animation>

Build an animation from a file path.

Returns None if the file cannot be loaded or parsed. Note: This will return None for non-UTF8 paths or paths containing null bytes.

Trait Implementations§

Source§

impl Debug for Builder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Builder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more