pub struct AnimationStateMachine {
pub states: HashMap<String, AnimState>,
pub transitions: Vec<AnimTransition>,
pub params: HashMap<String, f32>,
pub triggers: HashMap<String, bool>,
pub current_state: Option<String>,
}Expand description
Simple animation state machine.
Fields§
§states: HashMap<String, AnimState>§transitions: Vec<AnimTransition>§params: HashMap<String, f32>§triggers: HashMap<String, bool>§current_state: Option<String>Implementations§
Source§impl AnimationStateMachine
impl AnimationStateMachine
pub fn new() -> Self
pub fn add_state(&mut self, state: AnimState)
pub fn add_transition(&mut self, transition: AnimTransition)
pub fn set_param(&mut self, name: &str, value: f32)
pub fn set_trigger(&mut self, name: &str)
pub fn start(&mut self, state: &str)
Sourcepub fn evaluate(&mut self, animation_done: bool) -> Option<String>
pub fn evaluate(&mut self, animation_done: bool) -> Option<String>
Evaluate transitions. Returns the new animation name if state changed.
Sourcepub fn current_animation(&self) -> Option<&str>
pub fn current_animation(&self) -> Option<&str>
Current animation name from the active state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnimationStateMachine
impl RefUnwindSafe for AnimationStateMachine
impl Send for AnimationStateMachine
impl Sync for AnimationStateMachine
impl Unpin for AnimationStateMachine
impl UnsafeUnpin for AnimationStateMachine
impl UnwindSafe for AnimationStateMachine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more