Basic Animations

<
>
October 14, 2021

I added very basic animations for Belts, Arms and LongArms.
I split the arms into a base and top image where the top and Item are being rotated depending on the Arm‘s cooldown.

fn arm_node(x: &Arm) -> Node {
    let mut rotation = PI * x.cooldown() as f64 / Arm::cooldown_max() as f64;
    if x.content().is_some() {
        rotation = PI - rotation;
    }
    rotation += PI;
    ...

For Belts I created a few frames with moving direction arrows which I choose depending on cooldown and I also animated the Items to move depending on the cooldown.

fn belt_node(x: &Belt) -> Node {
    let cooldown_rel = x.cooldown() as f64 / Belt::cooldown_max() as f64;
    let texture = if cooldown_rel < 0.25 {
        Texture::Belt1
    } else if cooldown_rel < 0.5 {
        Texture::Belt2
    } else if cooldown_rel < 0.75 {
        Texture::Belt3
    } else {
        Texture::Belt4
    };
    let input_offset = -0.4 + 0.8 * (1.0 - x.cooldown() as f64 / Belt::cooldown_max() as f64);
    ...