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.
Tuple Fields
0: HashMap<String, AnimatorState, RandomState>
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>
pub fn value_progress(
&self,
anim_id: &str,
value_name: &str
) -> Option<AnimatedValueProgress>
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>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<AnimatorStates, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
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,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
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
Mutably borrows from an owned value. Read more