Skip to main content

Crate ranim_anims

Crate ranim_anims 

Source
Expand description

Ranim’s built-in animation families.

Each module contains named, closed-form animation types plus the convenience traits used to construct them from an item (e.g. fading::FadingAnim). Every animation type implements Eval directly; composition containers (AnimSequence, AnimStack, AnimLagged) live in ranim_core::animation::compose, and generic authoring adapters live in ranim_core::animation:

A built-in animation is a struct that implements Eval together with the data its closed form needs. For example, fading::FadeIn:

ⓘ
pub struct FadeIn<T: FadingRequirement> {
    src: T,
    dst: T,
}

impl<T: FadingRequirement> Eval for FadeIn<T> {
    type Output = T;

    fn eval_alpha(&self, alpha: f64) -> Self::Output {
        self.src.lerp(&self.dst, alpha)
    }
}

Construction traits mutate the source item to its end state while building the animation:

ⓘ
pub trait FadingAnim: FadingRequirement + Sized + 'static {
    fn fade_in(&mut self) -> FadeIn<Self>;
    fn fade_out(&mut self) -> FadeOut<Self>;
}

impl<T: FadingRequirement + Sized + 'static> FadingAnim for T {
    fn fade_in(&mut self) -> FadeIn<Self> {
        FadeIn::new(self.clone()).apply_to(self)
    }

    fn fade_out(&mut self) -> FadeOut<Self> {
        FadeOut::new(self.clone()).apply_to(self)
    }
}

Modules§

camera
Camera frame animations. Camera frame animations.
creation
Creation animations.
fading
Fading animations.
morph
Morph animations.
rotating
Rotating animations.