Struct oxygengine_user_interface::raui::core::animator::AnimatorStates [−][src]
pub struct AnimatorStates(pub HashMap<String, AnimatorState, RandomState>);
Expand description
The current state of animations in a component
The AnimatorStates
can be accessed from the WidgetContext
to get information about the
current state of all component animations.
Example
fn my_widget(context: WidgetContext) -> WidgetNode { // Get the animator from our context let WidgetContext { animator, .. } = context; // Create the properties for a size box let size_box_props = Props::new(SizeBoxProps { transform: Transform { // Get the `scale` value of the `my_anim` animation or and // scale our button based on the animation progress scale: Vec2::from(animator.value_progress_factor_or("my_anim", "scale", 1.)), ..Default::default() }, ..Default::default() }); // Wrap our button in our animated size box widget! { (size_box: {size_box_props} { content = (my_button) }) } }
Animations & Values
A component may have any number of different animations identified by a string anim_id
.
Additionally each animation can have more than one value that is animated and each of these
values has a value_name
that can be used to get the animated value.
Implementations
Returns whether or not any of the animations for this component are in-progress
Returns true
if none of this component’s animations are currently running
Returns true if the widget has an animation with the given anim_id
pub fn value_progress(
&self,
anim_id: &str,
value_name: &str
) -> Option<AnimatedValueProgress>
[src]
pub fn value_progress(
&self,
anim_id: &str,
value_name: &str
) -> Option<AnimatedValueProgress>
[src]Get the current progress of the animation of a given value
This will return None
if the value is not currently being animated.
Same as value_progress_factor
but returning default
instead of None
Same as value_progress_factor
but returning 0
instead of None
Trait Implementations
Returns the “default value” for a type. Read more
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<AnimatorStates, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<AnimatorStates, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for AnimatorStates
impl Send for AnimatorStates
impl Sync for AnimatorStates
impl Unpin for AnimatorStates
impl UnwindSafe for AnimatorStates
Blanket Implementations
impl<T> Any for T where
T: Any,
impl<T> Any for T where
T: Any,
pub fn get_type_id(&self) -> TypeId
Mutably borrows from an owned value. Read more
impl<T> TryDefault for T where
T: Default,
impl<T> TryDefault for T where
T: Default,
pub fn try_default() -> Result<T, String>
pub fn try_default() -> Result<T, String>
Tries to create the default.
fn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls try_default
and panics on an error case.