token-value-map
Time-based data mapping library for animation and interpolation.
Overview
Types for storing and manipulating data that changes over time, with automatic interpolation between keyframes. Supports uniform (constant) and animated (time-varying) values with multiple interpolation methods. Think your Maya/Blender/Houdini/whatever Attribute Editor.
Features
Tokenkey type -- wrapsustr::Ustr(withustrfeature, default) for O(1) interned string comparison, or plainStringwithout it.- Scalar types:
Boolean,Integer,Real,String. Color.- 2D types:
Vector2,Matrix3. - 3D types:
Vector3,Point3,Normal3,Matrix4. - Collection variants of all types.
- Curve types for curves/ramps:
RealCurve,ColorCurve(withcurvesfeature, default). - Linear, quadratic, and hermite interpolation.
- Motion blur sampling support.
Feature Flags
default-- Includesbuiltin-types,2d,vec_variants,glam,ustr,curves.ustr-- Useustrfor interned stringTokenkeys (default on). Without this,TokenwrapsString.curves-- EnableRealCurveandColorCurvefor position-keyed parameter mappings.2d-- Enable 2D types (Vector2,Matrix3).3d-- Enable 3D types (Vector3,Matrix4,Normal3,Point3).vec_variants-- Enable vector collection types.interpolation-- Enable keyframe interpolation with Bezier handles.serde-- Enable serialization/deserialization viaserde.rkyv-- Enable zero-copy deserialization viarkyv(requiresglambackend).facet-- Enable reflection/introspection viafacet.lua-- Enable Lua bindings viamlua.glam/nalgebra/ultraviolet-- Math backend (mutually exclusive,glamis default).mint-- Enablemintinterop for cross-library type conversion.
Example
use Tick;
use ;
// Create a token-value map for animation parameters.
let mut params = new;
// Add uniform (constant) values.
params.insert;
// Add animated values with keyframes.
let animated_position = animated.unwrap;
params.insert;
// Interpolate animated value at any time.
if let Some = params.get
License
Licensed under either of
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be quad-licensed as above, without any additional terms or conditions.