Animatable
struct · ferroui-livecharts · v0.5.0
struct Animatable
A named collection of typed motion values and motionless state properties.
Call begin_frame and read every drawn property, or call sample_frame, to
recompute is_valid. A getter invalidates the frame while its motion remains
active, exactly as source drawing getters do. Each frame uses one host time.
Members
is_validremove_on_completednewregister_motionregister_stateget_property_definitionproperty_definitionsgetsetget_valuetarget_valueregister_parsercoerce_valueset_valueset_transitionremove_transitioncomplete_transitionmotion_infomotioncopy_motion_fromimport_propertiesclone_snapshoton_completedremove_completed_handlerbegin_framesample_framecan_removeis_state_activeactive_states
is_valid
is_valid: bool
remove_on_completed
remove_on_completed: bool
new
fn new() -> Self
register_motion
fn register_motion<T: Interpolate + 'static>(self: &mut Self, name: impl Into<String>, default: T) -> Result<PropertyKey<T>, PropertyError>
register_state
fn register_state<T: Clone + 'static>(self: &mut Self, name: impl Into<String>, default: T) -> Result<PropertyKey<T>, PropertyError>
get_property_definition
fn get_property_definition(self: &Self, name: &str) -> Option<&PropertyDefinition>
property_definitions
fn property_definitions(self: &Self) -> impl Iterator<Item = &PropertyDefinition>
get
fn get<T: Clone + 'static>(self: &mut Self, property: &PropertyKey<T>, now_ms: f64) -> Result<T, PropertyError>
set
fn set<T: Clone + 'static>(self: &mut Self, property: &PropertyKey<T>, value: T, now_ms: f64) -> Result<(), PropertyError>
get_value
fn get_value(self: &mut Self, name: &str, now_ms: f64) -> Result<PropertyValue, PropertyError>
target_value
fn target_value(self: &Self, name: &str) -> Result<PropertyValue, PropertyError>
Gets the destination for motion values and the current value otherwise. Visual states use this to restore the original intended value mid-flight.
register_parser
fn register_parser<T: 'static>(self: &mut Self, parser: impl Fn(&str) -> Option<T> + 'static)
coerce_value
fn coerce_value(self: &Self, name: &str, value: PropertyValue) -> Result<PropertyValue, PropertyError>
set_value
fn set_value(self: &mut Self, name: &str, value: PropertyValue, now_ms: f64) -> Result<(), PropertyError>
set_transition
fn set_transition(self: &mut Self, animation: Option<Animation>, properties: &[&str]) -> Result<(), PropertyError>
remove_transition
fn remove_transition(self: &mut Self, properties: &[&str]) -> Result<(), PropertyError>
complete_transition
fn complete_transition(self: &mut Self, properties: &[&str]) -> Result<(), PropertyError>
motion_info
fn motion_info(self: &Self, name: &str) -> Result<Option<MotionInfo>, PropertyError>
motion
fn motion<T: Interpolate + 'static>(self: &Self, property: &PropertyKey<T>) -> Result<Option<&MotionProperty<T>>, PropertyError>
copy_motion_from
fn copy_motion_from(self: &mut Self, name: &str, source: &Animatable, source_name: &str) -> Result<(), PropertyError>
import_properties
fn import_properties(self: &mut Self, prototype: &Animatable)
Imports prototype values and definitions; later imports replace duplicate names, matching source base/derived definition precedence. Callbacks are instance-local and are never copied into the destination.
clone_snapshot
fn clone_snapshot(self: &mut Self, now_ms: f64) -> Result<Self, PropertyError>
Clones the visible values into independent defaults/from/to baselines. Sampling happens once per property; no animation, callback or state tracker is carried into the resulting instance.
on_completed
fn on_completed(self: &mut Self, name: &str, callback: impl Fn(&mut Animatable, f64) -> () + 'static) -> Result<CompletionToken, PropertyError>
remove_completed_handler
fn remove_completed_handler(self: &mut Self, token: CompletionToken) -> bool
begin_frame
fn begin_frame(self: &mut Self)
sample_frame
fn sample_frame(self: &mut Self, now_ms: f64) -> bool
can_remove
fn can_remove(self: &Self) -> bool
is_state_active
fn is_state_active(self: &Self, name: &str) -> bool
active_states
fn active_states(self: &Self) -> impl Iterator<Item = &str>
Active states in activation order; setting an active state keeps its place.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyClassDefaultsErasedDestructorIntoEitherDefaultDebug
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.