Skip to main content

Module motion

Module motion 

Source
Expand description

Motion path interpolation for keyframe animations

This module provides bezier curve interpolation and easing functions for smooth motion in animations. It supports:

  • Linear interpolation
  • Standard easing functions (ease-in, ease-out, ease-in-out)
  • Cubic bezier interpolation with control points
  • CSS steps() timing function
  • Automatic arc path fitting

§Example

use pixelsrc::motion::{Interpolation, interpolate, Point2D};

// Linear interpolation between two points
let start = Point2D { x: 0.0, y: 0.0 };
let end = Point2D { x: 100.0, y: 50.0 };
let mid = interpolate_point(&start, &end, 0.5, Interpolation::Linear);
assert_eq!(mid.x, 50.0);
assert_eq!(mid.y, 25.0);

Structs§

ControlPoint
Control point for bezier curves
Point2D
A 2D point for motion path calculations

Enums§

Interpolation
Interpolation method for keyframe animation
MotionPath
Motion path type for position interpolation
StepPosition
Step position for CSS steps() timing function.
TimingFunctionError
Error type for timing function parsing Error type for timing function parsing failures

Functions§

ease
Apply easing to a normalized time value (0.0 to 1.0)
generate_motion_frames
Generate intermediate frames for a keyframe animation
interpolate_path
Interpolate along a motion path
interpolate_point
Interpolate between two points with easing
interpolate_value
Interpolate a single value between keyframes
parse_interpolation
Parse interpolation mode from string
parse_motion_path
Parse motion path from string
parse_timing_function
Parse a CSS timing function string.