Crate token_value_map

Crate token_value_map 

Source
Expand description

A time-based data mapping library for animation and interpolation.

This crate provides types for storing and manipulating data that changes over time. It supports both uniform (static) and animated (time-varying) values with automatic interpolation between keyframes.

§Core Types

  • Value: A value that can be either uniform or animated over time.
  • Data: A variant enum containing all supported data types.
  • AnimatedData: Time-indexed data with interpolation support.
  • TimeDataMap: A mapping from time to data values.
  • TokenValueMap: A collection of named values indexed by tokens.

§Data Types

The library supports scalar types (Boolean, Integer, Real, String), vector types (Vector2, [Vector3], Color, Matrix3), and collections of these types (BooleanVec, IntegerVec, etc.).

§Motion Blur Sampling

Use the Sample trait with a Shutter to generate motion blur samples for animated values during rendering.

§Interpolation (Optional Feature)

When the interpolation feature is enabled, TimeDataMap supports advanced interpolation modes including bezier curves with tangent control. This enables integration with professional animation systems like Dopamine.

§Examples

use frame_tick::Tick;
use token_value_map::*;

// Create a uniform value.
let uniform = Value::uniform(42.0);

// Create an animated value.
let animated =
    Value::animated(vec![(Tick::new(0), 0.0), (Tick::new(10), 10.0)])
        .unwrap();

// Sample at a specific time.
let interpolated = animated.interpolate(Tick::new(5));

Structs§

Boolean
A boolean value wrapper.
BooleanVec
A vector of boolean values.
Color
A 4-component RGBA color value.
ColorVec
A vector of color values.
Integer
A 64-bit signed integer wrapper.
IntegerVec
A vector of integer values.
Matrix3
A 3×3 transformation matrix.
Matrix3Vec
A vector of transformation matrices.
Real
A 64-bit floating-point number wrapper.
RealVec
A vector of real values.
Shutter
Shutter timing for motion blur sampling.
String
A UTF-8 string wrapper.
StringVec
A vector of string values.
TimeDataMap
A mapping from time to data values with interpolation support.
TokenValueMap
A collection of named values indexed by string tokens.
Vector2
A 2D vector.
Vector2Vec
A vector of 2D vectors.

Enums§

AnimatedData
Time-indexed data with interpolation support.
Data
A variant enum containing all supported data types.
DataType
Value
A value that can be either uniform or animated over time.

Traits§

AnimatedDataOps
Common operations trait for animated data types.
DataTypeOps
Trait for getting data type information.
Sample
trait for generating motion blur samples with shutter timing.
TimeDataMapControl
Control operations trait for time data maps.

Type Aliases§

SampleWeight
Weight value for motion blur sampling.
Time
A time value represented as a fixed-point Tick.