pico-animation 0.2.0

An Animation module for the pico engine ecs system
Documentation
use pico_ecs::{_component_storage::ComponentStorage, _world::World};

use crate::components::{_animator::Animator, _animator_state::AnimatorState};


pub fn run(world: &World, animator_storage: &mut ComponentStorage<Animator>, animator_state_storage: &ComponentStorage<AnimatorState>) {
    for (_entity, animator, animator_state) in world.query_1mut_1(
        animator_storage,
         animator_state_storage,
    ) {
        if animator.current_animation == animator_state.animation_state {
            continue;
        }

        animator.current_animation = animator_state.animation_state;
        animator.current_frame_index = 0;
        animator.frame_timer = 1000; // Force immediate frame update
    }
}