Crate lottieconv
source · [−]Expand description
Convert lottie animations to GIF or WEBP format.
Examples
This example shows how to use this crate to convert a lottie animation to a gif
animation. This requires the gif
feature which is enabled by default.
ⓘ
use lottieconv::{Animation, Converter, Rgba};
use std::fs::File;
let animation = Animation::from_file("animation.json")?;
let mut out = File::create("animation.gif")?;
Converter::new(animation)
.gif(Rgba::new_alpha(0, 0, 0, true), &mut out)?
.convert()?;
This example shows how to use this crate to convert a lottie animation to a webp
animation. This requires the webp
feature which is enabled by default.
ⓘ
use lottieconv::{Animation, Converter};
use std::{fs::File, io::Write as _};
let animation = Animation::from_file("animation.json")?;
let webp_data = Converter::new(animation).webp()?.convert()?;
let mut out = File::create("animation.webp")?;
out.write_all(&webp_data)?;
Re-exports
Structs
This type is used to build a Converter
. It is created using
Converter::new()
.
This type is used to perform the conversion. It does nothing unless you
call .convert()
.
Type Definitions
This type is used to define the background of a GIF.