rdi-core 0.2.29

Platform-agnostic animation core for rusty-desktop-icons (curves, duration, spec, error, backend trait).
Documentation

Platform-agnostic animation core for rusty-desktop-icons.

This crate defines the pure-Rust, cross-platform surface of the project:

  • Geometry primitives ([Point]) and icon identifiers ([IconId]).
  • The [Curve] system with two variants ([BuiltinEasing] and [KeyframeCurve]) that share a single [AnimationCurve] contract.
  • A [Duration] policy that resolves to a concrete std::time::Duration either from a fixed value or from movement distance and speed.
  • The animation specification types ([IconAnimationSpec], [AnimationOptions], [FolderFlagOp]).
  • Error types shared by all backends.

The Windows Shell/COM backend, the worker thread, and the Python bindings live in sibling crates and depend on this one.

Everything in this crate is #![forbid(unsafe_code)] — the only place unsafe is allowed is inside rdi-platform-windows.

Quick tour of curves

use rdi_core::{AnimationCurve, Curve, KeyframeInterp};

// Predefined easing.
let ease = Curve::ease_in_out();
assert!((ease.eval(0.5) - 0.5).abs() < 1e-3);

// Data-driven keyframes.
let keys = Curve::keyframes(
    vec![
        rdi_core::Keyframe::new(0.0, 0.0),
        rdi_core::Keyframe::new(0.5, 0.9),
        rdi_core::Keyframe::new(1.0, 1.0),
    ],
    KeyframeInterp::Linear,
).unwrap();
assert!(keys.eval(0.5) > 0.5);

// Function-generated curve — sampled once, then pure data at runtime.
let damped = Curve::from_curve_fn(
    |t| 1.0 - (1.0 - t).powi(3),
    32,
    KeyframeInterp::Linear,
).unwrap();
assert!(damped.eval(1.0) > 0.9);