tawasuyu/llimphi
Sovereign retained-mode GPU UI framework in Rust (wgpu+vello+taffy+parley), Elm loop, 40+ widgets.
chore: refresco desde el monorepo — 128 miembros, los 76 widgets y los 11 módulos
1// Copyright 2024 the Velato Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! Render a Lottie animation to a Vello [`Scene`](crate::vello::Scene).
5//!
6//! This currently lacks support for a [number of important](crate#unsupported-features) SVG features.
7//!
8//! This is also intended to be the preferred integration between Vello and [usvg](https://crates.io/crates/usvg),
9//! so [consider contributing](https://github.com/linebender/vello_svg) if you need a feature which is missing.
10//!
11//! This crate also re-exports [`vello`], so you can easily use the specific version that is compatible with it.
12//!
13//! ## Usage
14//!
15//! ```no_run
16//! use foreign_lottie::{Composition, Renderer, vello};
17//!
18//! // El Lottie entra como bytes — de disco, de la red, o embebido.
19//! let lottie = std::fs::read("animacion.json").expect("archivo legible");
20//! let composition = Composition::from_slice(&lottie).expect("Lottie válido");
21//!
22//! let mut renderer = Renderer::new();
23//! let frame = 0.0; // Cualquier cuadro válido de la animación.
24//! let transform = vello::kurbo::Affine::IDENTITY;
25//! let alpha = 1.0;
26//! let scene = renderer.render_to_vello_scene(&composition, frame, transform, alpha);
27//! ```
28//!
29//! # Unsupported features
30//!
31//! Missing features include:
32//! - Position keyframe (`ti`, `to`) easing
33//! - Time remapping (`tm`)
34//! - Text
35//! - Image embedding
36//! - Advanced shapes (stroke dash, zig-zag, etc.)
37//! - Advanced effects (motion blur, drop shadows, etc.)
38//! - Correct color stop handling
39//! - Split rotations
40//! - Split positions
41
42// LINEBENDER LINT SET - lib.rs - v4
43// See https://linebender.org/wiki/canonical-lints/
44// These lints shouldn't apply to examples or tests.
45#![cfg_attr(not(test), warn(unused_crate_dependencies))]
46// These lints shouldn't apply to examples.
47#![warn(clippy::print_stdout, clippy::print_stderr)]
48// Targeting e.g. 32-bit means structs containing usize can give false positives for 64-bit.
49#![cfg_attr(target_pointer_width = "64", warn(clippy::trivially_copy_pass_by_ref))]
50// END LINEBENDER LINT SET
51#![cfg_attr(docsrs, feature(doc_cfg))]
52// The following lints are part of the Linebender standard set,
53// but resolving them has been deferred for now.
54// Feel free to send a PR that solves one or more of these.
55#![allow(unused, reason = "Many lottie types we don't yet support.")]
56#![allow(
57 unreachable_pub,
58 missing_docs,
59 elided_lifetimes_in_paths,
60 single_use_lifetimes,
61 unused_qualifications,
62 clippy::empty_docs,
63 clippy::use_self,
64 clippy::return_self_not_must_use,
65 clippy::cast_possible_truncation,
66 clippy::shadow_unrelated,
67 clippy::missing_assert_message,
68 clippy::missing_errors_doc,
69 clippy::exhaustive_enums,
70 clippy::todo,
71 reason = "Deferred"
72)]
73#![cfg_attr(
74 test,
75 allow(
76 unused_crate_dependencies,
77 reason = "Some dev dependencies are only used in tests"
78 )
79)]
80
81pub(crate) mod import;
82pub(crate) mod runtime;
83pub mod schema;
84
85mod error;
86pub use error::Error;
87
88// Re-export vello
89#[cfg(feature = "vello")]
90pub use vello;
91
92pub use runtime::{Composition, RenderSink, Renderer, model};