Skip to main content

Module vector_arithmetic

Module vector_arithmetic 

Source
Expand description

VectorArithmetic trait for types that can be linearly interpolated.

This module provides the foundation for animation interpolation. The native animation system uses these traits to interpolate between values when animating properties.

§Design

Uses Rust’s existing std::ops traits (Add, Sub, Mul) with a blanket impl. Types just need to implement these traits to be animatable.

§Examples

use waterui_core::vector_arithmetic::VectorArithmetic;

// f64 already implements VectorArithmetic via blanket impl
let a = 0.0_f64;
let b = 1.0_f64;
let mid = a.lerp(&b, 0.5);
assert!((mid - 0.5).abs() < 0.001);

Structs§

AnimatablePair
Pair for composing two animatable values together.
Point2
A 2D point or size that can be animated.

Traits§

VectorArithmetic
Types that can be linearly interpolated.