rusty_desktop_icons.Curve

class rusty_desktop_icons.Curve

Animation curve.

Every axis of every icon animation is driven by a value in [0, 1] produced by evaluating a Curve. Overshoot (values outside [0, 1]) is permitted.

classmethod bounce(bounces: int = 3, decay: float = 0.5) → Curve

Bouncing curve — several damped rebounds converging on 1.

classmethod cubic_bezier(c1x: float, c1y: float, c2x: float, c2y: float) → Curve

CSS-style parametric cubic Bézier through (0, 0), (c1x, c1y), (c2x, c2y) and (1, 1). c1x and c2x must lie in [0, 1].

classmethod cubic_in() → Curve
classmethod cubic_in_out() → Curve
classmethod cubic_out() → Curve
classmethod ease_in() → Curve
classmethod ease_in_out() → Curve
classmethod ease_out() → Curve
classmethod elastic(period: float = 0.3, amplitude: float = 1.0) → Curve

Elastic ease-out — sinusoidal overshoot damped by 2^(-10t).

eval(t: float) → float

Evaluate the curve at t (saturated to [0, 1]).

classmethod from_function(f: Callable[[float], float], samples: int = 64, interp: KeyframeInterp | str = 'linear') → Curve

Sample a Python callable f(t) -> v at samples evenly-spaced points in [0, 1] and build a keyframe curve.

The callable is invoked only during this call and dropped immediately after; the resulting curve is pure data. Any exception raised by the callable becomes an InvalidCurve error.

classmethod from_motion_function(f: Callable[[MotionContext, float], float], origin: Sequence[int], target: Sequence[int], duration_seconds: float, params: dict[str, float] | None = None, samples: int = 64, interp: KeyframeInterp | str = 'linear') → Curve

Sample a motion-aware Python callable f(ctx, t) -> v at samples evenly-spaced points in [0, 1].

The callable receives a [MotionContext](rusty_desktop_icons.MotionContext) built from origin, target, duration_seconds and params, plus the normalized time t. It is invoked only during this call.

classmethod keyframes(keys: list[tuple[float, float] | list[float] | dict[str, float]], interp: KeyframeInterp | str = 'linear') → Curve

Build a curve from an explicit list of (t, v) keyframes.

keys must start with (0.0, …), end with (1.0, …), and be strictly ascending in t. Prefer KeyframeInterp members for interp; legacy strings and case-insensitive aliases remain accepted.

classmethod linear() → Curve
classmethod overshoot(strength: float = 1.7) → Curve

Back / overshoot ease-in-out.

classmethod quad_in() → Curve
classmethod quad_in_out() → Curve
classmethod quad_out() → Curve
classmethod sine_in() → Curve
classmethod sine_in_out() → Curve
classmethod sine_out() → Curve
classmethod spring(damping: float = 0.5, stiffness: float = 180.0, mass: float = 1.0) → Curve

Damped-cosine “spring” curve.

property kind: rusty_desktop_icons._enums.CurveKind

Curve representation, compatible with the legacy string discriminator.