pub struct Animation { /* private fields */ }Expand description
Fluent builder for an LVGL animation.
Configure the animation step-by-step, then call Animation::start —
LVGL copies the state into its internal animation list, so the
builder can be dropped immediately after.
§Callback constraints
In no_std Rust we’re stuck with extern "C" fn pointers for
exec_cb / ready_cb — no closures. Use the animate_x,
animate_y, animate_width, animate_opa helpers for the
common cases where you just want to tween a single property.
Implementations§
Source§impl Animation
impl Animation
Sourcepub fn target(self, var: *mut c_void) -> Self
pub fn target(self, var: *mut c_void) -> Self
Set the target variable (typically obj.raw() as *mut c_void).
Sourcepub fn path(self, cb: lv_anim_path_cb_t) -> Self
pub fn path(self, cb: lv_anim_path_cb_t) -> Self
Set the easing path callback. Use e.g. path_ease_out.
Sourcepub fn repeat_count(self, count: u32) -> Self
pub fn repeat_count(self, count: u32) -> Self
Set the repeat count; use ANIM_REPEAT_INFINITE for endless.
Sourcepub fn repeat_delay(self, ms: u32) -> Self
pub fn repeat_delay(self, ms: u32) -> Self
Set the delay between repeats.
Sourcepub fn playback_duration(self, ms: u32) -> Self
pub fn playback_duration(self, ms: u32) -> Self
Set the duration of the reverse (playback) phase.
Sourcepub fn playback_delay(self, ms: u32) -> Self
pub fn playback_delay(self, ms: u32) -> Self
Set the delay before the playback phase.
Sourcepub fn exec_cb(self, cb: lv_anim_exec_xcb_t) -> Self
pub fn exec_cb(self, cb: lv_anim_exec_xcb_t) -> Self
Set the exec callback invoked every frame with (var, value).
Sourcepub fn completed_cb(self, cb: lv_anim_completed_cb_t) -> Self
pub fn completed_cb(self, cb: lv_anim_completed_cb_t) -> Self
Set the callback invoked when the animation completes (lv_anim_set_completed_cb).
Source§impl Animation
impl Animation
Sourcepub fn duration_for_speed(speed: u32) -> u32
pub fn duration_for_speed(speed: u32) -> u32
Configure the animation duration based on a movement speed
(LVGL’s lv_anim_speed). Returns the precomputed duration value.
Sourcepub fn tick_fn<W: Widget>(self, obj: W, on_tick: fn(Obj, i32)) -> Self
pub fn tick_fn<W: Widget>(self, obj: W, on_tick: fn(Obj, i32)) -> Self
Set both the animation target and a safe tick callback.
on_tick(obj, v) is invoked every frame with the target widget
(as Obj) and the interpolated value. Uses LVGL’s custom exec
callback so the fn pointer is smuggled through user_data.