moonbit-easings

A dependency-free MoonBit motion toolkit for media timelines, easing curves, cubic Bezier inversion, and scalar keyframes.

animation
easing
tween
bezier
keyframe
media
moon add Zlj6566/moonbit-easings@0.1.0
Download zip
Author
Version
0.1.0
License
MIT
Last updated
4 hours ago
Downloads
2
README

#moonbit-easings

MoonBit 数字媒体补间动画与贝塞尔缓动函数库:为 UI 交互、游戏镜头、数字艺术和离线媒体提供可组合、无运行时依赖的运动学基础设施。

#项目定位

moonbit-easings 负责“时间、数值和运动轨迹如何变化”,不负责窗口渲染、资源解析或具体 UI 框架。它可以作为渲染器、游戏循环、音视频导出器和交互式编辑器的底层采样层,输出标量、向量、颜色、变换、路径和事件数据。

项目把 easing、Cubic-Bezier 时间轴求逆、Tween、关键帧轨道、时间线、路径和传输控制放在统一的数据模型中,同时保持核心包不依赖平台 I/O,适合 Wasm、Wasm-GC、JavaScript 和 Native 目标。

#核心能力

  • 31 个内建 easing:Linear、Quad、Cubic、Quart、Quint、Sine、Expo、Circ、Back、Elastic、Bounce。
  • Bezier::new(x1, y1, x2, y2):缓存采样表、Newton 迭代和二分回退组成稳定的时间轴求逆器。
  • Tween 与 ScalarTrack:支持 delay、repeat、Mirror、Continue、逐段曲线、速度和加速度。
  • 多媒体类型:Point2、Point3、RGBA、Transform2D、颜色渐变、Hermite 和 Catmull-Rom。
  • 轨迹编排:命名标记、MarkerCursor、ScalarTrackBundle、MotionStateMachine、MotionClip 和 ClipSequence。
  • 几何与时间:Spline2D/Spline3D、复合 Path2D、距离采样、投影、边界框和 Piecewise RetimeMap。
  • 离线分析:固定帧率与自适应采样、信号滤波、峰值、积分、单调性、曲线报告和可复现实验入口。

与只提供基础 easing 函数的包相比,本项目的重点是可直接接入数字媒体工作流的轨道、时间、路径和导出层;它不复制其他生态包的实现,也不绑定 Lottie、Canvas 或某个游戏引擎。

#快速开始

要求 MoonBit stable 0.10.7 或更新版本。

moon add Zlj6566/moonbit-easings

moon.pkg 中导入:

///|
import {
"Zlj6566/moonbit-easings" @easings,
}

最小 Tween 示例:

let curve = try! @easings.Bezier::new(0.25, 0.1, 0.25, 1.0)
let tween = try! @easings.Tween::new(
0.0,
320.0,
1.0,
curve=@easings.Curve::bezier(curve),
)
let sample = tween.sample_motion(0.5)
println(sample.value().to_string())
println(sample.velocity().to_string())

#CLI

仓库提供两个可运行入口:

# 展示 Tween、关键帧、颜色渐变和序列组合 moon run cmd/demo # 运行可复现的 Native 工作负载并打印校验和 moon run --target native --release cmd/bench

cmd/bench 不把主机时钟写入库 API;它打印固定迭代次数、采样校验和和自适应采样结果,主机耗时由 BENCHMARKS.md 中的测量命令取得。

#架构

Easing / Bezier │ ├── Tween / Keyframe / ScalarTrack │ │ │ ├── Timeline / Bundle / StateMachine │ └── Clip / Sequence / Transport / Markers │ ├── Point / Color / Transform Tracks ├── Spline / Path / RetimeMap └── Sampling / Signal / Diagnostics

主要模块按职责拆分:easing_*.mbtbezier*.mbt 提供曲线内核;keyframe_*.mbttween.mbttimeline.mbt 提供时间数据模型;typed_tracks.mbtpath.mbtspline.mbtpath_geometry.mbt 提供数字媒体值与几何;adaptive_sampling.mbtsignal_processing.mbtcurve_analysis.mbt 面向离线导出与质量检查;motion_clip.mbtmotion_transport.mbtmotion_markers.mbtmotion_state_machine.mbt 面向运行时编排。

核心采样函数只在调用者明确请求批量结果时分配输出数组;Bezier 单点采样使用缓存表、Newton 迭代和二分回退,不创建临时采样数组。

#基准

基准说明、工具链版本、机器环境、完整输出和重复测量方式见 BENCHMARKS.md。本地执行:

moon build --target native --release cmd/bench moon run --target native --release cmd/bench

校验和用于确认不同构建目标实际执行了同一工作负载;墙钟数据不被当作跨机器的绝对性能承诺。

#测试

提交前执行完整检查:

moon fmt --check moon info --target all git diff --exit-code moon check --fmt --deny-warn --target all moon build --target all moon test --deny-warn --target all

测试覆盖 easing 边界、Bezier 参数求逆、重复和镜像时间、关键帧排序、向量/颜色/变换插值、路径端点、空输入、非法参数、标记方向、轨迹投影、自适应采样、重映射、信号边界和 Native/JS/Wasm 全目标行为。

#CI

.github/workflows/test.yml 在 Ubuntu、macOS 和 Windows 上安装官方 MoonBit stable 工具链,执行格式化、moon info 生成物差异检查、全目标检查、全目标构建和全目标测试,并开启 --deny-warn

.github/workflows/publish.yml 只在手动触发时验证同一检查链,并使用仓库 Secret 中的 MOONCAKES_TOKEN 发布包;日常 CI 不执行发布。基准程序不进入普通测试矩阵,可按文档在 Native Release 模式单独运行。

#许可证

本项目采用 MIT License,见 LICENSE。实现来源和第三方生态边界见 SOURCES.md

#
MotionError

pub(all) suberror MotionError {
InvalidBezierX(Double, Double)
InvalidSampleCount(Int)
InvalidTime(Double)
InvalidDuration(Double)
InvalidDelay(Double)
InvalidRepeatCount(Int)
EmptyTrack
NonIncreasingKeyframe(Double, Double)
InvalidFrameRate(Double)
InvalidPointCount(Int)
InvalidTension(Double)
InvalidSegmentCount(Int)
InvalidThreshold(Double)
InvalidMarkerName
InvalidChannelName
InvalidRetimeSegment
InvalidStateName
}

Errors raised while constructing or validating motion primitives.

#
AdaptiveSamplePoint

pub(all) struct AdaptiveSamplePoint {
time : Double
value : Double
depth : Int
} derive(
Debug
)

A scalar sample with a subdivision depth for diagnostics and renderers.

#
AdaptiveSamplePoint::depth

fn AdaptiveSamplePoint::depth(self : AdaptiveSamplePoint) -> Int

#
AdaptiveSamplePoint::time

fn AdaptiveSamplePoint::time(self : AdaptiveSamplePoint) -> Double

#
AdaptiveSamplePoint::value

fn AdaptiveSamplePoint::value(self : AdaptiveSamplePoint) -> Double

#
AdaptiveSampleResult

pub(all) struct AdaptiveSampleResult {
points : Array[AdaptiveSamplePoint]
accepted_segments : Int
rejected_segments : Int
maximum_error : Double
} derive(
Debug
)

Result metadata for an adaptive sample pass.

#
AdaptiveSampleResult::accepted_segments

fn AdaptiveSampleResult::accepted_segments(self : AdaptiveSampleResult) -> Int

#
AdaptiveSampleResult::maximum_error

fn AdaptiveSampleResult::maximum_error(self : AdaptiveSampleResult) -> Double

#
AdaptiveSampleResult::points

#
AdaptiveSampleResult::rejected_segments

fn AdaptiveSampleResult::rejected_segments(self : AdaptiveSampleResult) -> Int

#
AdaptiveSamplingConfig

pub struct AdaptiveSamplingConfig {
tolerance : Double
max_depth : Int
max_samples : Int
} derive(
Debug
)

Controls recursive subdivision of a scalar motion signal.

#
AdaptiveSamplingConfig::max_depth

fn AdaptiveSamplingConfig::max_depth(self : AdaptiveSamplingConfig) -> Int

#
AdaptiveSamplingConfig::max_samples

fn AdaptiveSamplingConfig::max_samples(self : AdaptiveSamplingConfig) -> Int

#
AdaptiveSamplingConfig::new

fn AdaptiveSamplingConfig::new(tolerance : Double, max_depth? : Int, max_samples? : Int) -> AdaptiveSamplingConfig raise MotionError

#
AdaptiveSamplingConfig::tolerance

fn AdaptiveSamplingConfig::tolerance(self : AdaptiveSamplingConfig) -> Double

#
Bezier

pub struct Bezier {
x1 : Double
y1 : Double
x2 : Double
y2 : Double
sample_values : Array[Double]
} derive(
Debug
)

A cached cubic Bézier timing curve.

The x controls must lie in [0, 1], while y controls may overshoot for spring-like or expressive motion. Construction builds a small lookup table; evaluation only reads the table and performs scalar arithmetic.

#
Bezier::approximate_length

fn Bezier::approximate_length(self : Bezier, segments : Int) -> Double

A coarse arc-length estimate in parameter space, useful for diagnostics.

#
Bezier::as_easing

fn Bezier::as_easing(self : Bezier) -> ((Double) -> Double)

Return the curve as a first-class easing function.

#
Bezier::control_points

fn Bezier::control_points(self : Bezier) -> (Double, Double, Double, Double)

#
Bezier::derivative

fn Bezier::derivative(self : Bezier, x : Double) -> Double

Derivative dy/dx at a normalized time. A zero x slope returns zero.

#
Bezier::max_error

fn Bezier::max_error(self : Bezier, reference : (Double) -> Double, samples : Int) -> Double

Return the maximum absolute difference between this curve and a reference.

#
Bezier::new

fn Bezier::new(x1 : Double, y1 : Double, x2 : Double, y2 : Double, sample_count? : Int) -> Bezier raise MotionError

Construct a cubic timing curve with a cached lookup table.

#
Bezier::reversed

fn Bezier::reversed(self : Bezier) -> Bezier

Reverse the direction of a cubic timing curve.

#
Bezier::sample

fn Bezier::sample(self : Bezier, x : Double) -> Double

Evaluate the y coordinate at normalized time x.

#
Bezier::sample_many

fn Bezier::sample_many(self : Bezier, count : Int) -> Array[Double] raise MotionError

#
Bezier::solve_time

fn Bezier::solve_time(self : Bezier, x : Double) -> Double

Solve the time parameter t for a normalized x coordinate.

#
Bounds2D

pub(all) struct Bounds2D {
minimum : Point2
maximum : Point2
} derive(
Debug
)

Axis-aligned bounds for a sampled media path.

#
Bounds2D::maximum

fn Bounds2D::maximum(self : Bounds2D) -> Point2

#
Bounds2D::minimum

fn Bounds2D::minimum(self : Bounds2D) -> Point2

#
BundleSample

pub(all) struct BundleSample {
time : Double
names : Array[String]
values : Array[Double]
weighted_value : Double
active_weight : Double
} derive(
Debug
)

The combined result at one timestamp. weighted_value is the normalized blend of enabled channels; individual values remain available for output.

#
BundleSample::active_weight

fn BundleSample::active_weight(self : BundleSample) -> Double

#
BundleSample::length

fn BundleSample::length(self : BundleSample) -> Int

#
BundleSample::names

fn BundleSample::names(self : BundleSample) -> Array[String]

#
BundleSample::time

fn BundleSample::time(self : BundleSample) -> Double

#
BundleSample::value_at

fn BundleSample::value_at(self : BundleSample, index : Int) -> Double?

#
BundleSample::value_named

fn BundleSample::value_named(self : BundleSample, name : String) -> Double?

#
BundleSample::values

fn BundleSample::values(self : BundleSample) -> Array[Double]

#
BundleSample::weighted_value

fn BundleSample::weighted_value(self : BundleSample) -> Double

#
ClipLoopMode

pub(all) enum ClipLoopMode {
Once
Repeat
PingPong
} derive(Eq,
Debug
)

Playback policy for a reusable motion clip.

#
ClipSequence

pub struct ClipSequence {
items : Array[ClipSequenceItem]
duration : Double
} derive(
Debug
)

A sequence compositor that averages overlapping clip contributions.

#
ClipSequence::duration

fn ClipSequence::duration(self : ClipSequence) -> Double

#
ClipSequence::items

#
ClipSequence::length

fn ClipSequence::length(self : ClipSequence) -> Int

#
ClipSequence::markers_between

fn ClipSequence::markers_between(self : ClipSequence, start : Double, end : Double) -> Array[MarkerHit]

#
ClipSequence::new

#
ClipSequence::sample

fn ClipSequence::sample(self : ClipSequence, time : Double) -> Double

#
ClipSequence::sample_many

fn ClipSequence::sample_many(self : ClipSequence, count : Int) -> Array[SamplePoint] raise MotionError

#
ClipSequenceBuilder

pub struct ClipSequenceBuilder {
items : Array[ClipSequenceItem]
} derive(
Debug
)

#
ClipSequenceBuilder::add

#
ClipSequenceBuilder::add_at

fn ClipSequenceBuilder::add_at(self : ClipSequenceBuilder, clip : MotionClip, start : Double, weight? : Double) -> ClipSequenceBuilder raise MotionError

#
ClipSequenceBuilder::build

#
ClipSequenceBuilder::length

fn ClipSequenceBuilder::length(self : ClipSequenceBuilder) -> Int

#
ClipSequenceBuilder::new

#
ClipSequenceItem

pub struct ClipSequenceItem {
clip : MotionClip
start : Double
weight : Double
} derive(
Debug
)

A clip placed at a start offset in a larger composition.

#
ClipSequenceItem::clip

#
ClipSequenceItem::end

fn ClipSequenceItem::end(self : ClipSequenceItem) -> Double

#
ClipSequenceItem::start

fn ClipSequenceItem::start(self : ClipSequenceItem) -> Double

#
ClipSequenceItem::weight

fn ClipSequenceItem::weight(self : ClipSequenceItem) -> Double

#
ColorGradient

pub struct ColorGradient {
stops : Array[GradientStop]
premultiplied : Bool
} derive(
Debug
)

A validated one-dimensional color gradient for UI and media rendering.

#
ColorGradient::end

fn ColorGradient::end(self : ColorGradient) -> Double

#
ColorGradient::length

fn ColorGradient::length(self : ColorGradient) -> Int

#
ColorGradient::new

fn ColorGradient::new(stops : Array[GradientStop], premultiplied? : Bool) -> ColorGradient raise MotionError

#
ColorGradient::premultiplied

fn ColorGradient::premultiplied(self : ColorGradient) -> Bool

#
ColorGradient::reversed

fn ColorGradient::reversed(self : ColorGradient) -> ColorGradient

Return a gradient with the stop order and transition directions reversed.

#
ColorGradient::sample

fn ColorGradient::sample(self : ColorGradient, position : Double) -> Rgba

Sample the gradient. Values outside its declared range are clamped.

#
ColorGradient::sample_many

fn ColorGradient::sample_many(self : ColorGradient, count : Int) -> Array[Rgba] raise MotionError

#
ColorGradient::start

fn ColorGradient::start(self : ColorGradient) -> Double

#
ColorGradient::stops

#
CubicPath2D

pub struct CubicPath2D {
start : Point2
control_start : Point2
control_end : Point2
end : Point2
} derive(
Debug
)

A cubic geometric Bézier path. This is separate from Bezier timing curves.

#
CubicPath2D::bounds

fn CubicPath2D::bounds(self : CubicPath2D, segments? : Int) -> Bounds2D

#
CubicPath2D::length

fn CubicPath2D::length(self : CubicPath2D, segments : Int) -> Double

#
CubicPath2D::polyline

fn CubicPath2D::polyline(self : CubicPath2D, segments : Int) -> Array[Point2]

#
CubicPath2D::sample

fn CubicPath2D::sample(self : CubicPath2D, t : Double) -> Point2

#
CubicPath2D::sample_by_distance

fn CubicPath2D::sample_by_distance(self : CubicPath2D, distance : Double, segments? : Int) -> Point2

#
CubicPath2D::tangent

fn CubicPath2D::tangent(self : CubicPath2D, t : Double) -> Point2

#
Curve

pub(all) enum Curve {
Builtin(EasingId)
CubicBezier(Bezier)
} derive(
Debug
)

A curve selector stored on a keyframe transition.

#
Curve::apply

fn Curve::apply(self : Curve, t : Double) -> Double

#
Curve::bezier

fn Curve::bezier(curve : Bezier) -> Curve

#
Curve::builtin

fn Curve::builtin(id : EasingId) -> Curve

#
Curve::derivative

fn Curve::derivative(self : Curve, t : Double) -> Double

#
CurveAnalysisPoint

pub(all) struct CurveAnalysisPoint {
time : Double
value : Double
velocity : Double
acceleration : Double
normalized_value : Double
} derive(
Debug
)

A sample enriched with first and second derivative estimates.

#
CurveAnalysisPoint::acceleration

fn CurveAnalysisPoint::acceleration(self : CurveAnalysisPoint) -> Double

#
CurveAnalysisPoint::normalized_value

fn CurveAnalysisPoint::normalized_value(self : CurveAnalysisPoint) -> Double

#
CurveAnalysisPoint::time

fn CurveAnalysisPoint::time(self : CurveAnalysisPoint) -> Double

#
CurveAnalysisPoint::value

fn CurveAnalysisPoint::value(self : CurveAnalysisPoint) -> Double

#
CurveAnalysisPoint::velocity

fn CurveAnalysisPoint::velocity(self : CurveAnalysisPoint) -> Double

#
CurveChain

pub struct CurveChain {
curves : Array[Curve]
weights : Array[Double]
total_weight : Double
} derive(
Debug
)

A piecewise curve used to choreograph a multi-stage motion.

#
CurveChain::derivative

fn CurveChain::derivative(self : CurveChain, t : Double) -> Double

#
CurveChain::length

fn CurveChain::length(self : CurveChain) -> Int

#
CurveChain::new

fn CurveChain::new(curves : Array[Curve], weights? : Array[Double]) -> CurveChain raise MotionError

#
CurveChain::sample

fn CurveChain::sample(self : CurveChain, t : Double) -> Double

#
CurveChain::sample_many

fn CurveChain::sample_many(self : CurveChain, count : Int) -> Array[Double] raise MotionError

#
CurveMonotonicity

pub(all) enum CurveMonotonicity {
Increasing
Decreasing
Constant
Mixed
} derive(Eq,
Debug
)

#
CurveReport

pub(all) struct CurveReport {
samples : Int
minimum : Double
maximum : Double
endpoint_error : Double
monotonic : Bool
peak_velocity : Double
peak_acceleration : Double
} derive(
Debug
)

Summary metrics for comparing or previewing a motion curve.

#
CurveReport::endpoint_error

fn CurveReport::endpoint_error(self : CurveReport) -> Double

#
CurveReport::is_monotonic

fn CurveReport::is_monotonic(self : CurveReport) -> Bool

#
CurveReport::maximum

fn CurveReport::maximum(self : CurveReport) -> Double

#
CurveReport::minimum

fn CurveReport::minimum(self : CurveReport) -> Double

#
CurveReport::peak_acceleration

fn CurveReport::peak_acceleration(self : CurveReport) -> Double

#
CurveReport::peak_velocity

fn CurveReport::peak_velocity(self : CurveReport) -> Double

#
CurveReport::samples

fn CurveReport::samples(self : CurveReport) -> Int

#
EasingId

pub(all) enum EasingId {
Linear
QuadIn
QuadOut
QuadInOut
CubicIn
CubicOut
CubicInOut
QuartIn
QuartOut
QuartInOut
QuintIn
QuintOut
QuintInOut
SineIn
SineOut
SineInOut
ExpoIn
ExpoOut
ExpoInOut
CircIn
CircOut
CircInOut
BackIn
BackOut
BackInOut
ElasticIn
ElasticOut
ElasticInOut
BounceIn
BounceOut
BounceInOut
} derive(Eq,
Debug
)

Families of easing curves used by a motion timeline.

#
EasingId::apply

fn EasingId::apply(self : EasingId, t : Double) -> Double

Evaluate a built-in easing curve.

#
EasingId::derivative

fn EasingId::derivative(self : EasingId, t : Double) -> Double

First derivative of a built-in easing curve on normalized time.

#
Extrapolation

pub(all) enum Extrapolation {
Clamp
Repeat
Mirror
Continue
} derive(Eq,
Debug
)

Extrapolation policy for a keyframe track or a tween.

#
FrameClock

pub struct FrameClock {
frame_rate : Double
origin : Double
} derive(
Debug
)

Frame clock for deterministic media time conversion.

#
FrameClock::frame_rate

fn FrameClock::frame_rate(self : FrameClock) -> Double

#
FrameClock::frame_times

fn FrameClock::frame_times(self : FrameClock, first_frame : Int, last_frame : Int) -> Array[Double]

#
FrameClock::frame_to_seconds

fn FrameClock::frame_to_seconds(self : FrameClock, frame : Int) -> Double

#
FrameClock::new

fn FrameClock::new(frame_rate : Double, origin? : Double) -> FrameClock raise MotionError

#
FrameClock::quantize

fn FrameClock::quantize(self : FrameClock, seconds : Double) -> Double

#
FrameClock::seconds_to_frame

fn FrameClock::seconds_to_frame(self : FrameClock, seconds : Double) -> Int

#
GradientBuilder

pub struct GradientBuilder {
stops : Array[GradientStop]
premultiplied : Bool
}

A builder for gradients assembled by an editor or an importer.

#
GradientBuilder::add

fn GradientBuilder::add(self : GradientBuilder, stop : GradientStop) -> Unit

#
GradientBuilder::build

#
GradientBuilder::new

fn GradientBuilder::new(premultiplied? : Bool) -> GradientBuilder

#
GradientBuilder::remove_at

fn GradientBuilder::remove_at(self : GradientBuilder, index : Int) -> GradientStop?

#
GradientStop

pub struct GradientStop {
position : Double
color : Rgba
curve : Curve
} derive(
Debug
)

A color stop whose curve controls the transition to the next stop.

#
GradientStop::color

fn GradientStop::color(self : GradientStop) -> Rgba

#
GradientStop::curve

fn GradientStop::curve(self : GradientStop) -> Curve

#
GradientStop::position

fn GradientStop::position(self : GradientStop) -> Double

#
Hsv

pub(all) struct Hsv {
hue : Double
saturation : Double
value : Double
alpha : Double
} derive(
Debug
)

Hue, saturation, value and alpha representation.

#
Hsv::alpha

fn Hsv::alpha(self : Hsv) -> Double

#
Hsv::hue

fn Hsv::hue(self : Hsv) -> Double

#
Hsv::saturation

fn Hsv::saturation(self : Hsv) -> Double

#
Hsv::to_rgba

fn Hsv::to_rgba(self : Hsv) -> Rgba

#
Hsv::value

fn Hsv::value(self : Hsv) -> Double

#
Keyframe

pub struct Keyframe {
time : Double
value : Double
curve : Curve
} derive(
Debug
)

A scalar keyframe. Its curve controls the segment beginning at this frame.

#
Keyframe::curve

fn Keyframe::curve(self : Keyframe) -> Curve

#
Keyframe::time

fn Keyframe::time(self : Keyframe) -> Double

#
Keyframe::value

fn Keyframe::value(self : Keyframe) -> Double

#
MarkerCursor

pub struct MarkerCursor {
timeline : MarkerTimeline
time : Double
} derive(
Debug
)

A cursor for deterministic marker dispatch in a transport loop.

#
MarkerCursor::advance

fn MarkerCursor::advance(self : MarkerCursor, time : Double) -> Array[MarkerHit]

#
MarkerCursor::reset

fn MarkerCursor::reset(self : MarkerCursor, time? : Double) -> Unit

#
MarkerCursor::seek

fn MarkerCursor::seek(self : MarkerCursor, time : Double) -> Unit

#
MarkerCursor::time

fn MarkerCursor::time(self : MarkerCursor) -> Double

#
MarkerCursor::timeline

fn MarkerCursor::timeline(self : MarkerCursor) -> MarkerTimeline

#
MarkerDirection

pub(all) enum MarkerDirection {
Forward
Backward
} derive(Eq,
Debug
)

Direction of playback when a marker window is traversed.

#
MarkerHit

pub(all) struct MarkerHit {
marker : MotionMarker
direction : MarkerDirection
} derive(
Debug
)

A marker together with the direction in which it was crossed.

#
MarkerHit::direction

fn MarkerHit::direction(self : MarkerHit) -> MarkerDirection

#
MarkerHit::marker

fn MarkerHit::marker(self : MarkerHit) -> MotionMarker

#
MarkerHit::name

fn MarkerHit::name(self : MarkerHit) -> String

#
MarkerHit::time

fn MarkerHit::time(self : MarkerHit) -> Double

#
MarkerTimeline

pub struct MarkerTimeline {
markers : Array[MotionMarker]
} derive(
Debug
)

A sorted marker index for transport controls, editors, and event dispatch.

#
MarkerTimeline::add

fn MarkerTimeline::add(self : MarkerTimeline, value : MotionMarker) -> Unit

#
MarkerTimeline::at

fn MarkerTimeline::at(self : MarkerTimeline, time : Double, tolerance? : Double) -> Array[MotionMarker]

#
MarkerTimeline::between

fn MarkerTimeline::between(self : MarkerTimeline, start : Double, end : Double) -> Array[MarkerHit]

Return markers crossed while moving from start to end. The start boundary is excluded and the end boundary is included.

#
MarkerTimeline::duration

fn MarkerTimeline::duration(self : MarkerTimeline) -> Double

#
MarkerTimeline::empty

#
MarkerTimeline::find

fn MarkerTimeline::find(self : MarkerTimeline, name : String) -> Array[MotionMarker]

#
MarkerTimeline::length

fn MarkerTimeline::length(self : MarkerTimeline) -> Int

#
MarkerTimeline::markers

#
MarkerTimeline::new

#
MarkerTimeline::next_after

fn MarkerTimeline::next_after(self : MarkerTimeline, time : Double) -> MotionMarker?

#
MarkerTimeline::previous_before

fn MarkerTimeline::previous_before(self : MarkerTimeline, time : Double) -> MotionMarker?

#
MarkerTimeline::remove_at

fn MarkerTimeline::remove_at(self : MarkerTimeline, index : Int) -> MotionMarker?

#
MarkerTimeline::window

fn MarkerTimeline::window(self : MarkerTimeline, start : Double, end : Double) -> Array[MarkerHit]

#
MotionBounds

pub struct MotionBounds {
minimum : Double
maximum : Double
} derive(
Debug
)

Bounds used to keep generated motion within a safe output range.

#
MotionBounds::clamp

fn MotionBounds::clamp(self : MotionBounds, value : Double) -> Double

#
MotionBounds::maximum

fn MotionBounds::maximum(self : MotionBounds) -> Double

#
MotionBounds::minimum

fn MotionBounds::minimum(self : MotionBounds) -> Double

#
MotionBounds::new

fn MotionBounds::new(minimum : Double, maximum : Double) -> MotionBounds raise MotionError

#
MotionClip

pub struct MotionClip {
name : String
track : ScalarTrack
markers : MarkerTimeline
loop_mode : ClipLoopMode
} derive(
Debug
)

A named, timestamped scalar motion clip with optional marker events.

#
MotionClip::duration

fn MotionClip::duration(self : MotionClip) -> Double

#
MotionClip::end_time

fn MotionClip::end_time(self : MotionClip) -> Double

#
MotionClip::loop_mode

fn MotionClip::loop_mode(self : MotionClip) -> ClipLoopMode

#
MotionClip::markers

fn MotionClip::markers(self : MotionClip) -> MarkerTimeline

#
MotionClip::markers_between

fn MotionClip::markers_between(self : MotionClip, start : Double, end : Double) -> Array[MarkerHit]

#
MotionClip::name

fn MotionClip::name(self : MotionClip) -> String

#
MotionClip::sample

fn MotionClip::sample(self : MotionClip, time : Double) -> Double

#
MotionClip::sample_many

fn MotionClip::sample_many(self : MotionClip, count : Int) -> Array[SamplePoint] raise MotionError

#
MotionClip::sample_motion

fn MotionClip::sample_motion(self : MotionClip, time : Double) -> MotionSample

#
MotionClip::scale_time

fn MotionClip::scale_time(self : MotionClip, factor : Double) -> MotionClip raise MotionError

#
MotionClip::shift

fn MotionClip::shift(self : MotionClip, offset : Double) -> MotionClip raise MotionError

#
MotionClip::start_time

fn MotionClip::start_time(self : MotionClip) -> Double

#
MotionClip::track

fn MotionClip::track(self : MotionClip) -> ScalarTrack

#
MotionClip::with_loop_mode

fn MotionClip::with_loop_mode(self : MotionClip, loop_mode : ClipLoopMode) -> MotionClip

#
MotionClip::with_markers

fn MotionClip::with_markers(self : MotionClip, markers : MarkerTimeline) -> MotionClip

#
MotionClipLibrary

pub struct MotionClipLibrary {
clips : Array[MotionClip]
} derive(
Debug
)

A small library for resolving named clips at runtime.

#
MotionClipLibrary::add

fn MotionClipLibrary::add(self : MotionClipLibrary, clip : MotionClip) -> Unit

#
MotionClipLibrary::clips

#
MotionClipLibrary::find

fn MotionClipLibrary::find(self : MotionClipLibrary, name : String) -> MotionClip?

#
MotionClipLibrary::length

fn MotionClipLibrary::length(self : MotionClipLibrary) -> Int

#
MotionClipLibrary::new

#
MotionClipLibrary::remove

fn MotionClipLibrary::remove(self : MotionClipLibrary, name : String) -> MotionClip?

#
MotionClipLibrary::total_duration

fn MotionClipLibrary::total_duration(self : MotionClipLibrary) -> Double

#
MotionMarker

pub struct MotionMarker {
time : Double
name : String
payload : String
} derive(
Debug
)

A named event attached to a motion timeline.

#
MotionMarker::name

fn MotionMarker::name(self : MotionMarker) -> String

#
MotionMarker::payload

fn MotionMarker::payload(self : MotionMarker) -> String

#
MotionMarker::time

fn MotionMarker::time(self : MotionMarker) -> Double

#
MotionSample

pub(all) struct MotionSample {
time : Double
value : Double
velocity : Double
acceleration : Double
} derive(
Debug
)

A compact sample of a scalar motion function.

#
MotionSample::acceleration

fn MotionSample::acceleration(self : MotionSample) -> Double

#
MotionSample::value

fn MotionSample::value(self : MotionSample) -> Double

#
MotionSample::velocity

fn MotionSample::velocity(self : MotionSample) -> Double

#
MotionSignal

pub struct MotionSignal {
values : Array[Double]
start : Double
step : Double
} derive(
Debug
)

A lightweight signal buffer for post-processing sampled motion data.

#
MotionSignal::at

fn MotionSignal::at(self : MotionSignal, index : Int) -> Double?

#
MotionSignal::clamp

fn MotionSignal::clamp(self : MotionSignal, minimum : Double, maximum : Double) -> MotionSignal

#
MotionSignal::duration

fn MotionSignal::duration(self : MotionSignal) -> Double

#
MotionSignal::end

fn MotionSignal::end(self : MotionSignal) -> Double

#
MotionSignal::length

fn MotionSignal::length(self : MotionSignal) -> Int

#
MotionSignal::map

fn MotionSignal::map(self : MotionSignal, func : (Double) -> Double) -> MotionSignal

#
MotionSignal::new

fn MotionSignal::new(values : Array[Double], start : Double, step : Double) -> MotionSignal raise MotionError

#
MotionSignal::offset

fn MotionSignal::offset(self : MotionSignal, amount : Double) -> MotionSignal

#
MotionSignal::reverse

fn MotionSignal::reverse(self : MotionSignal) -> MotionSignal

#
MotionSignal::sample

fn MotionSignal::sample(self : MotionSignal, time : Double) -> Double

#
MotionSignal::sample_many

fn MotionSignal::sample_many(self : MotionSignal, count : Int) -> Array[SamplePoint] raise MotionError

#
MotionSignal::scale

fn MotionSignal::scale(self : MotionSignal, factor : Double) -> MotionSignal

#
MotionSignal::start

fn MotionSignal::start(self : MotionSignal) -> Double

#
MotionSignal::step

fn MotionSignal::step(self : MotionSignal) -> Double

#
MotionSignal::values

fn MotionSignal::values(self : MotionSignal) -> Array[Double]

#
MotionSignal::zip_map

fn MotionSignal::zip_map(self : MotionSignal, other : MotionSignal, func : (Double, Double) -> Double) -> MotionSignal

#
MotionStateMachine

pub struct MotionStateMachine {
states : Array[MotionStateNode]
transitions : Array[MotionStateTransition]
current : String
transition_from : String
transition_to : String
transition_start : Double
transition_duration : Double
transition_curve : Curve
has_transition : Bool
} derive(
Debug
)

A transition engine with explicit transport time. State changes are deterministic and do not allocate per sample.

#
MotionStateMachine::add_state

fn MotionStateMachine::add_state(self : MotionStateMachine, state : MotionStateNode) -> Unit raise MotionError

#
MotionStateMachine::add_transition

fn MotionStateMachine::add_transition(self : MotionStateMachine, transition : MotionStateTransition) -> Unit raise MotionError

#
MotionStateMachine::complete

fn MotionStateMachine::complete(self : MotionStateMachine) -> Unit

#
MotionStateMachine::current

fn MotionStateMachine::current(self : MotionStateMachine) -> String

#
MotionStateMachine::has_state

fn MotionStateMachine::has_state(self : MotionStateMachine, name : String) -> Bool

#
MotionStateMachine::is_transitioning

fn MotionStateMachine::is_transitioning(self : MotionStateMachine) -> Bool

#
MotionStateMachine::new

fn MotionStateMachine::new(states : Array[MotionStateNode], transitions? : Array[MotionStateTransition], initial? : String) -> MotionStateMachine raise MotionError

#
MotionStateMachine::reset

fn MotionStateMachine::reset(self : MotionStateMachine, state? : String) -> Unit raise MotionError

#
MotionStateMachine::sample

fn MotionStateMachine::sample(self : MotionStateMachine, now : Double) -> Double

#
MotionStateMachine::sample_motion

fn MotionStateMachine::sample_motion(self : MotionStateMachine, now : Double) -> MotionSample

#
MotionStateMachine::state_value

fn MotionStateMachine::state_value(self : MotionStateMachine, name : String) -> Double?

#
MotionStateMachine::states

#
MotionStateMachine::transition_to

fn MotionStateMachine::transition_to(self : MotionStateMachine, target : String, now : Double, duration? : Double, curve? : Curve) -> Unit raise MotionError

Start a transition at an arbitrary transport timestamp.

#
MotionStateMachine::transitions

#
MotionStateNode

pub struct MotionStateNode {
name : String
value : Double
} derive(
Debug
)

A named scalar state used to model interaction modes and animation poses.

#
MotionStateNode::name

fn MotionStateNode::name(self : MotionStateNode) -> String

#
MotionStateNode::value

fn MotionStateNode::value(self : MotionStateNode) -> Double

#
MotionStateTransition

pub struct MotionStateTransition {
from : String
to : String
duration : Double
curve : Curve
} derive(
Debug
)

A directed transition between two named motion states.

#
MotionStateTransition::curve

#
MotionStateTransition::duration

fn MotionStateTransition::duration(self : MotionStateTransition) -> Double

#
MotionStateTransition::from

fn MotionStateTransition::from(self : MotionStateTransition) -> String

#
MotionStateTransition::to

#
MotionTransport

pub struct MotionTransport {
position : Double
speed : Double
status : TransportStatus
direction : PlaybackDirection
range : TransportRange
markers : MarkerTimeline
} derive(
Debug
)

A stateful transport clock for preview, timeline scrubbing, and export.

#
MotionTransport::advance

fn MotionTransport::advance(self : MotionTransport, delta_seconds : Double) -> Array[MarkerHit] raise MotionError

Advance the clock and return markers crossed by this step.

#
MotionTransport::clone_at

fn MotionTransport::clone_at(self : MotionTransport, position : Double) -> MotionTransport

#
MotionTransport::direction

#
MotionTransport::elapsed

fn MotionTransport::elapsed(self : MotionTransport) -> Double

#
MotionTransport::fast_forward

fn MotionTransport::fast_forward(self : MotionTransport) -> Unit

#
MotionTransport::is_at_boundary

fn MotionTransport::is_at_boundary(self : MotionTransport) -> Bool

#
MotionTransport::markers

#
MotionTransport::new

#
MotionTransport::normalized_position

fn MotionTransport::normalized_position(self : MotionTransport) -> Double

#
MotionTransport::pause

fn MotionTransport::pause(self : MotionTransport) -> Unit

#
MotionTransport::play

fn MotionTransport::play(self : MotionTransport) -> Unit

#
MotionTransport::position

fn MotionTransport::position(self : MotionTransport) -> Double

#
MotionTransport::range

#
MotionTransport::remaining

fn MotionTransport::remaining(self : MotionTransport) -> Double

#
MotionTransport::rewind

fn MotionTransport::rewind(self : MotionTransport) -> Unit

#
MotionTransport::seek

fn MotionTransport::seek(self : MotionTransport, position : Double) -> Unit raise MotionError

#
MotionTransport::seek_and_collect

fn MotionTransport::seek_and_collect(self : MotionTransport, position : Double) -> Array[MarkerHit] raise MotionError

#
MotionTransport::set_direction

fn MotionTransport::set_direction(self : MotionTransport, direction : PlaybackDirection) -> Unit

#
MotionTransport::set_speed

fn MotionTransport::set_speed(self : MotionTransport, speed : Double) -> Unit raise MotionError

#
MotionTransport::speed

fn MotionTransport::speed(self : MotionTransport) -> Double

#
MotionTransport::status

#
MotionTransport::stop

fn MotionTransport::stop(self : MotionTransport) -> Unit

#
Path2D

pub struct Path2D {
segments : Array[PathSegment2D]
lengths : Array[Double]
total_length : Double
} derive(
Debug
)

A length-indexed composition of line and cubic path segments.

#
Path2D::append

fn Path2D::append(self : Path2D, segment : PathSegment2D, samples_per_curve? : Int) -> Path2D raise MotionError

#
Path2D::bounds

fn Path2D::bounds(self : Path2D, samples_per_curve? : Int) -> Bounds2D

#
Path2D::end

fn Path2D::end(self : Path2D) -> Point2

#
Path2D::length

fn Path2D::length(self : Path2D) -> Int

#
Path2D::new

fn Path2D::new(segments : Array[PathSegment2D], samples_per_curve? : Int) -> Path2D raise MotionError

#
Path2D::polyline

fn Path2D::polyline(self : Path2D, samples_per_segment : Int) -> Array[Point2]

#
Path2D::project

fn Path2D::project(self : Path2D, target : Point2, samples_per_segment? : Int) -> SplineProjection

Approximate the nearest point by scanning each segment's polyline.

#
Path2D::sample

fn Path2D::sample(self : Path2D, parameter : Double) -> Point2

#
Path2D::sample_by_distance

fn Path2D::sample_by_distance(self : Path2D, distance : Double) -> Point2

#
Path2D::segments

fn Path2D::segments(self : Path2D) -> Array[PathSegment2D]

#
Path2D::start

fn Path2D::start(self : Path2D) -> Point2

#
Path2D::tangent

fn Path2D::tangent(self : Path2D, parameter : Double) -> Point2

#
Path2D::total_length

fn Path2D::total_length(self : Path2D) -> Double

#
PathBuilder2D

pub struct PathBuilder2D {
current : Point2
segments : Array[PathSegment2D]
} derive(
Debug
)

Builder for paths constructed from a start point and successive endpoints.

#
PathBuilder2D::build

fn PathBuilder2D::build(self : PathBuilder2D, samples_per_curve? : Int) -> Path2D raise MotionError

#
PathBuilder2D::close

fn PathBuilder2D::close(self : PathBuilder2D) -> Unit

#
PathBuilder2D::cubic_to

fn PathBuilder2D::cubic_to(self : PathBuilder2D, control_start : Point2, control_end : Point2, end : Point2) -> Unit

#
PathBuilder2D::current

fn PathBuilder2D::current(self : PathBuilder2D) -> Point2

#
PathBuilder2D::length

fn PathBuilder2D::length(self : PathBuilder2D) -> Int

#
PathBuilder2D::line_to

fn PathBuilder2D::line_to(self : PathBuilder2D, end : Point2) -> Unit

#
PathSegment2D

pub(all) enum PathSegment2D {
Line(Point2, Point2)
Cubic(CubicPath2D)
} derive(
Debug
)

Geometric segment types that can be composed into a renderable path.

#
PathSegment2D::bounds

fn PathSegment2D::bounds(self : PathSegment2D, samples? : Int) -> Bounds2D

#
PathSegment2D::polyline

fn PathSegment2D::polyline(self : PathSegment2D, samples : Int) -> Array[Point2]

#
PlaybackDirection

pub(all) enum PlaybackDirection {
Forward
Reverse
} derive(Eq,
Debug
)

Direction of a transport clock.

#
Point2

pub(all) struct Point2 {
x : Double
y : Double
} derive(
Debug
)

Two-dimensional point for UI and 2D media transforms.

#
Point2::distance

fn Point2::distance(self : Point2, other : Point2) -> Double

#
Point2::lerp

fn Point2::lerp(self : Point2, other : Point2, t : Double) -> Point2

#
Point2::x

fn Point2::x(self : Point2) -> Double

#
Point2::y

fn Point2::y(self : Point2) -> Double

#
Point2Keyframe

pub struct Point2Keyframe {
time : Double
value : Point2
curve : Curve
} derive(
Debug
)

A point keyframe for UI, camera, and sprite motion tracks.

#
Point2Keyframe::curve

fn Point2Keyframe::curve(self : Point2Keyframe) -> Curve

#
Point2Keyframe::time

fn Point2Keyframe::time(self : Point2Keyframe) -> Double

#
Point2Keyframe::value

fn Point2Keyframe::value(self : Point2Keyframe) -> Point2

#
Point2Track

pub struct Point2Track {
frames : Array[Point2Keyframe]
} derive(
Debug
)

A validated 2D point track with the same boundary policies as ScalarTrack.

#
Point2Track::duration

fn Point2Track::duration(self : Point2Track) -> Double

#
Point2Track::end_time

fn Point2Track::end_time(self : Point2Track) -> Double

#
Point2Track::keyframes

fn Point2Track::keyframes(self : Point2Track) -> Array[Point2Keyframe]

#
Point2Track::length

fn Point2Track::length(self : Point2Track) -> Int

#
Point2Track::new

#
Point2Track::sample

fn Point2Track::sample(self : Point2Track, time : Double, mode? : Extrapolation) -> Point2

#
Point2Track::sample_many

fn Point2Track::sample_many(self : Point2Track, count : Int, mode? : Extrapolation) -> Array[Point2] raise MotionError

#
Point2Track::start_time

fn Point2Track::start_time(self : Point2Track) -> Double

#
Point3

pub(all) struct Point3 {
x : Double
y : Double
z : Double
} derive(
Debug
)

Three-dimensional point for camera, scene, and 3D keyframe data.

#
Point3::lerp

fn Point3::lerp(self : Point3, other : Point3, t : Double) -> Point3

#
Point3::x

fn Point3::x(self : Point3) -> Double

#
Point3::y

fn Point3::y(self : Point3) -> Double

#
Point3::z

fn Point3::z(self : Point3) -> Double

#
Point3Keyframe

pub struct Point3Keyframe {
time : Double
value : Point3
curve : Curve
} derive(
Debug
)

A 3D keyframe for camera and scene transforms.

#
Point3Keyframe::curve

fn Point3Keyframe::curve(self : Point3Keyframe) -> Curve

#
Point3Keyframe::time

fn Point3Keyframe::time(self : Point3Keyframe) -> Double

#
Point3Keyframe::value

fn Point3Keyframe::value(self : Point3Keyframe) -> Point3

#
Point3Track

pub struct Point3Track {
frames : Array[Point3Keyframe]
} derive(
Debug
)

#
Point3Track::duration

fn Point3Track::duration(self : Point3Track) -> Double

#
Point3Track::end_time

fn Point3Track::end_time(self : Point3Track) -> Double

#
Point3Track::keyframes

fn Point3Track::keyframes(self : Point3Track) -> Array[Point3Keyframe]

#
Point3Track::length

fn Point3Track::length(self : Point3Track) -> Int

#
Point3Track::new

#
Point3Track::sample

fn Point3Track::sample(self : Point3Track, time : Double, mode? : Extrapolation) -> Point3

#
Point3Track::sample_many

fn Point3Track::sample_many(self : Point3Track, count : Int, mode? : Extrapolation) -> Array[Point3] raise MotionError

#
Point3Track::start_time

fn Point3Track::start_time(self : Point3Track) -> Double

#
RetimeMap

pub struct RetimeMap {
segments : Array[RetimeSegment]
input_start : Double
input_end : Double
output_start : Double
output_end : Double
} derive(
Debug
)

#
RetimeMap::derivative

fn RetimeMap::derivative(self : RetimeMap, input : Double) -> Double

#
RetimeMap::input_duration

fn RetimeMap::input_duration(self : RetimeMap) -> Double

#
RetimeMap::input_end

fn RetimeMap::input_end(self : RetimeMap) -> Double

#
RetimeMap::input_start

fn RetimeMap::input_start(self : RetimeMap) -> Double

#
RetimeMap::length

fn RetimeMap::length(self : RetimeMap) -> Int

#
RetimeMap::map

fn RetimeMap::map(self : RetimeMap, input : Double) -> Double

Map a source timestamp to presentation time. Gaps clamp to the adjacent segment, which is deterministic for scrubbing and export.

#
RetimeMap::new

fn RetimeMap::new(segments : Array[RetimeSegment]) -> RetimeMap raise MotionError

#
RetimeMap::output_duration

fn RetimeMap::output_duration(self : RetimeMap) -> Double

#
RetimeMap::output_end

fn RetimeMap::output_end(self : RetimeMap) -> Double

#
RetimeMap::output_start

fn RetimeMap::output_start(self : RetimeMap) -> Double

#
RetimeMap::reverse

fn RetimeMap::reverse(self : RetimeMap) -> RetimeMap raise MotionError

#
RetimeMap::sample

fn RetimeMap::sample(self : RetimeMap, count : Int) -> Array[SamplePoint] raise MotionError

#
RetimeMap::scale_output

fn RetimeMap::scale_output(self : RetimeMap, factor : Double) -> RetimeMap raise MotionError

#
RetimeMap::segments

fn RetimeMap::segments(self : RetimeMap) -> Array[RetimeSegment]

#
RetimeMap::shift_output

fn RetimeMap::shift_output(self : RetimeMap, offset : Double) -> RetimeMap raise MotionError

#
RetimeMap::unmap

fn RetimeMap::unmap(self : RetimeMap, output : Double) -> Double

#
RetimeMapBuilder

pub struct RetimeMapBuilder {
segments : Array[RetimeSegment]
} derive(
Debug
)

Build a map by appending non-overlapping source and presentation ranges.

#
RetimeMapBuilder::add

#
RetimeMapBuilder::build

#
RetimeMapBuilder::length

fn RetimeMapBuilder::length(self : RetimeMapBuilder) -> Int

#
RetimeMapBuilder::new

#
RetimeSegment

pub struct RetimeSegment {
input_start : Double
input_end : Double
output_start : Double
output_end : Double
curve : Curve
} derive(
Debug
)

A monotone time remapping segment. Input and output intervals are kept explicit so media editors can preserve source timestamps while changing presentation speed.

#
RetimeSegment::contains_input

fn RetimeSegment::contains_input(self : RetimeSegment, time : Double) -> Bool

#
RetimeSegment::contains_output

fn RetimeSegment::contains_output(self : RetimeSegment, time : Double) -> Bool

#
RetimeSegment::curve

fn RetimeSegment::curve(self : RetimeSegment) -> Curve

#
RetimeSegment::derivative

fn RetimeSegment::derivative(self : RetimeSegment, input : Double) -> Double

#
RetimeSegment::input_duration

fn RetimeSegment::input_duration(self : RetimeSegment) -> Double

#
RetimeSegment::input_end

fn RetimeSegment::input_end(self : RetimeSegment) -> Double

#
RetimeSegment::input_start

fn RetimeSegment::input_start(self : RetimeSegment) -> Double

#
RetimeSegment::map

fn RetimeSegment::map(self : RetimeSegment, input : Double) -> Double

#
RetimeSegment::output_duration

fn RetimeSegment::output_duration(self : RetimeSegment) -> Double

#
RetimeSegment::output_end

fn RetimeSegment::output_end(self : RetimeSegment) -> Double

#
RetimeSegment::output_start

fn RetimeSegment::output_start(self : RetimeSegment) -> Double

#
RetimeSegment::speed

fn RetimeSegment::speed(self : RetimeSegment) -> Double

#
RetimeSegment::unmap

fn RetimeSegment::unmap(self : RetimeSegment, output : Double) -> Double

#
Rgba

pub(all) struct Rgba {
r : Double
g : Double
b : Double
a : Double
} derive(
Debug
)

RGBA color stored in the normalized [0, 1] range.

#
Rgba::alpha

fn Rgba::alpha(self : Rgba) -> Double

#
Rgba::blue

fn Rgba::blue(self : Rgba) -> Double

#
Rgba::green

fn Rgba::green(self : Rgba) -> Double

#
Rgba::luminance

fn Rgba::luminance(self : Rgba) -> Double

#
Rgba::red

fn Rgba::red(self : Rgba) -> Double

#
Rgba::to_hsv

fn Rgba::to_hsv(self : Rgba) -> Hsv

#
RgbaKeyframe

pub struct RgbaKeyframe {
time : Double
value : Rgba
curve : Curve
} derive(
Debug
)

A color keyframe track for gradients, fades, and compositing timelines.

#
RgbaTrack

pub struct RgbaTrack {
frames : Array[RgbaKeyframe]
premultiplied : Bool
} derive(
Debug
)

#
RgbaTrack::duration

fn RgbaTrack::duration(self : RgbaTrack) -> Double

#
RgbaTrack::end_time

fn RgbaTrack::end_time(self : RgbaTrack) -> Double

#
RgbaTrack::keyframes

fn RgbaTrack::keyframes(self : RgbaTrack) -> Array[RgbaKeyframe]

#
RgbaTrack::length

fn RgbaTrack::length(self : RgbaTrack) -> Int

#
RgbaTrack::new

fn RgbaTrack::new(frames : Array[RgbaKeyframe], premultiplied? : Bool) -> RgbaTrack raise MotionError

#
RgbaTrack::sample

fn RgbaTrack::sample(self : RgbaTrack, time : Double, mode? : Extrapolation) -> Rgba

#
RgbaTrack::sample_many

fn RgbaTrack::sample_many(self : RgbaTrack, count : Int, mode? : Extrapolation) -> Array[Rgba] raise MotionError

#
RgbaTrack::start_time

fn RgbaTrack::start_time(self : RgbaTrack) -> Double

#
SamplePoint

pub(all) struct SamplePoint {
time : Double
value : Double
frame : Int
} derive(
Debug
)

#
SamplePoint::frame

fn SamplePoint::frame(self : SamplePoint) -> Int

#
SamplePoint::time

fn SamplePoint::time(self : SamplePoint) -> Double

#
SamplePoint::value

fn SamplePoint::value(self : SamplePoint) -> Double

#
SamplingConfig

pub struct SamplingConfig {
start : Double
end : Double
frame_rate : Double
include_end : Bool
} derive(
Debug
)

Deterministic sampling window for rendering or offline export.

#
SamplingConfig::end

fn SamplingConfig::end(self : SamplingConfig) -> Double

#
SamplingConfig::frame_count

fn SamplingConfig::frame_count(self : SamplingConfig) -> Int

#
SamplingConfig::frame_rate

fn SamplingConfig::frame_rate(self : SamplingConfig) -> Double

#
SamplingConfig::new

fn SamplingConfig::new(start : Double, end : Double, frame_rate : Double, include_end? : Bool) -> SamplingConfig raise MotionError

#
SamplingConfig::start

fn SamplingConfig::start(self : SamplingConfig) -> Double

#
ScalarChannel

pub struct ScalarChannel {
name : String
track : ScalarTrack
enabled : Bool
weight : Double
offset : Double
} derive(
Debug
)

A named scalar channel with editor-friendly activation and weighting.

#
ScalarChannel::duration

fn ScalarChannel::duration(self : ScalarChannel) -> Double

#
ScalarChannel::enabled

fn ScalarChannel::enabled(self : ScalarChannel) -> Bool

#
ScalarChannel::end_time

fn ScalarChannel::end_time(self : ScalarChannel) -> Double

#
ScalarChannel::name

fn ScalarChannel::name(self : ScalarChannel) -> String

#
ScalarChannel::offset

fn ScalarChannel::offset(self : ScalarChannel) -> Double

#
ScalarChannel::sample

fn ScalarChannel::sample(self : ScalarChannel, time : Double, mode? : Extrapolation) -> Double

#
ScalarChannel::start_time

fn ScalarChannel::start_time(self : ScalarChannel) -> Double

#
ScalarChannel::track

#
ScalarChannel::weight

fn ScalarChannel::weight(self : ScalarChannel) -> Double

#
ScalarChannel::with_enabled

fn ScalarChannel::with_enabled(self : ScalarChannel, enabled : Bool) -> ScalarChannel

#
ScalarChannel::with_offset

fn ScalarChannel::with_offset(self : ScalarChannel, offset : Double) -> ScalarChannel raise MotionError

#
ScalarChannel::with_weight

fn ScalarChannel::with_weight(self : ScalarChannel, weight : Double) -> ScalarChannel raise MotionError

#
ScalarTrack

pub struct ScalarTrack {
frames : Array[Keyframe]
} derive(
Debug
)

A validated, immutable-at-the-API scalar track.

#
ScalarTrack::duration

fn ScalarTrack::duration(self : ScalarTrack) -> Double

#
ScalarTrack::end_time

fn ScalarTrack::end_time(self : ScalarTrack) -> Double

#
ScalarTrack::keyframes

fn ScalarTrack::keyframes(self : ScalarTrack) -> Array[Keyframe]

#
ScalarTrack::length

fn ScalarTrack::length(self : ScalarTrack) -> Int

#
ScalarTrack::map_values

fn ScalarTrack::map_values(self : ScalarTrack, mapper : (Double) -> Double) -> ScalarTrack raise MotionError

Transform values without changing timing or curves.

#
ScalarTrack::new

fn ScalarTrack::new(frames : Array[Keyframe]) -> ScalarTrack raise MotionError

Build a scalar track from strictly increasing keyframes.

#
ScalarTrack::sample

fn ScalarTrack::sample(self : ScalarTrack, time : Double, mode? : Extrapolation) -> Double

Sample at an arbitrary time using the selected boundary policy.

#
ScalarTrack::sample_motion

fn ScalarTrack::sample_motion(self : ScalarTrack, time : Double, mode? : Extrapolation) -> MotionSample

#
ScalarTrack::sample_values

fn ScalarTrack::sample_values(self : ScalarTrack, times : Array[Double], mode? : Extrapolation) -> Array[Double]

#
ScalarTrack::scale_time

fn ScalarTrack::scale_time(self : ScalarTrack, factor : Double) -> ScalarTrack raise MotionError

Scale a track's time axis around its first keyframe.

#
ScalarTrack::shift

fn ScalarTrack::shift(self : ScalarTrack, offset : Double) -> ScalarTrack raise MotionError

Move a track in time while preserving its segment curves.

#
ScalarTrack::start_time

fn ScalarTrack::start_time(self : ScalarTrack) -> Double

#
ScalarTrack::trim

fn ScalarTrack::trim(self : ScalarTrack, start : Double, end : Double) -> ScalarTrack raise MotionError

Copy a time range, adding interpolated boundary frames when needed.

#
ScalarTrack::value_range

fn ScalarTrack::value_range(self : ScalarTrack, samples_per_segment : Int) -> (Double, Double)

#
ScalarTrack::velocity

fn ScalarTrack::velocity(self : ScalarTrack, time : Double, mode? : Extrapolation) -> Double

Estimate velocity with a central difference that respects track duration.

#
ScalarTrack::with_curve

fn ScalarTrack::with_curve(self : ScalarTrack, curve : Curve) -> ScalarTrack raise MotionError

Return a track with a replacement curve on every segment.

#
ScalarTrackBundle

pub struct ScalarTrackBundle {
channels : Array[ScalarChannel]
start_time : Double
end_time : Double
} derive(
Debug
)

A group of synchronized scalar tracks for UI properties, camera channels, or a compact control stream exported to a runtime.

#
ScalarTrackBundle::channels

#
ScalarTrackBundle::duration

fn ScalarTrackBundle::duration(self : ScalarTrackBundle) -> Double

#
ScalarTrackBundle::end_time

fn ScalarTrackBundle::end_time(self : ScalarTrackBundle) -> Double

#
ScalarTrackBundle::find

fn ScalarTrackBundle::find(self : ScalarTrackBundle, name : String) -> ScalarChannel?

#
ScalarTrackBundle::length

fn ScalarTrackBundle::length(self : ScalarTrackBundle) -> Int

#
ScalarTrackBundle::new

#
ScalarTrackBundle::sample

fn ScalarTrackBundle::sample(self : ScalarTrackBundle, time : Double, mode? : Extrapolation) -> BundleSample

#
ScalarTrackBundle::sample_many

fn ScalarTrackBundle::sample_many(self : ScalarTrackBundle, count : Int, mode? : Extrapolation) -> Array[BundleSample] raise MotionError

#
ScalarTrackBundle::set_enabled

fn ScalarTrackBundle::set_enabled(self : ScalarTrackBundle, name : String, enabled : Bool) -> ScalarTrackBundle raise MotionError

#
ScalarTrackBundle::set_weight

fn ScalarTrackBundle::set_weight(self : ScalarTrackBundle, name : String, weight : Double) -> ScalarTrackBundle raise MotionError

#
ScalarTrackBundle::start_time

fn ScalarTrackBundle::start_time(self : ScalarTrackBundle) -> Double

#
ScalarTrackBundle::with_channel

#
ScalarTrackBundle::without

fn ScalarTrackBundle::without(self : ScalarTrackBundle, name : String) -> ScalarTrackBundle raise MotionError

#
ScalarTrackBundleBuilder

pub struct ScalarTrackBundleBuilder {
channels : Array[ScalarChannel]
} derive(
Debug
)

#
ScalarTrackBundleBuilder::add

#
ScalarTrackBundleBuilder::build

#
ScalarTrackBundleBuilder::length

#
ScalarTrackBundleBuilder::new

#
ScalarTrackBundleBuilder::remove

fn ScalarTrackBundleBuilder::remove(self : ScalarTrackBundleBuilder, name : String) -> Bool

#
SequenceBuilder

pub struct SequenceBuilder {
tweens : Array[Tween]
gap : Double
}

A mutable composition helper used by editors and importers.

#
SequenceBuilder::add

fn SequenceBuilder::add(self : SequenceBuilder, tween : Tween) -> Unit

#
SequenceBuilder::build

#
SequenceBuilder::new

fn SequenceBuilder::new(gap? : Double) -> SequenceBuilder

#
SequenceBuilder::remove_at

fn SequenceBuilder::remove_at(self : SequenceBuilder, index : Int) -> Tween?

#
SequenceSample

pub(all) struct SequenceSample {
time : Double
value : Double
index : Int
progress : Double
state : SequenceState
} derive(
Debug
)

A sample from a TweenSequence, including the active segment index.

#
SequenceSample::index

fn SequenceSample::index(self : SequenceSample) -> Int

#
SequenceSample::progress

fn SequenceSample::progress(self : SequenceSample) -> Double

#
SequenceSample::state

#
SequenceSample::time

fn SequenceSample::time(self : SequenceSample) -> Double

#
SequenceSample::value

fn SequenceSample::value(self : SequenceSample) -> Double

#
SequenceState

pub(all) enum SequenceState {
Before
Active
Gap
After
} derive(Eq,
Debug
)

Lifecycle state for a serial composition of scalar tweens.

#
Spline2D

pub struct Spline2D {
points : Array[Point2]
tension : Double
closed : Bool
} derive(
Debug
)

A Catmull-Rom spline over 2D control points.

tension=0 is the standard centripetal-free Catmull-Rom form. The closed option connects the last control point back to the first one.

#
Spline2D::bounds

fn Spline2D::bounds(self : Spline2D, samples_per_segment? : Int) -> Bounds2D

#
Spline2D::closed

fn Spline2D::closed(self : Spline2D) -> Bool

#
Spline2D::control_points

fn Spline2D::control_points(self : Spline2D) -> Array[Point2]

#
Spline2D::length

fn Spline2D::length(self : Spline2D, samples_per_segment : Int) -> Double

#
Spline2D::new

fn Spline2D::new(points : Array[Point2], tension? : Double, closed? : Bool) -> Spline2D raise MotionError

#
Spline2D::point_count

fn Spline2D::point_count(self : Spline2D) -> Int

#
Spline2D::polyline

fn Spline2D::polyline(self : Spline2D, samples_per_segment : Int) -> Array[Point2]

#
Spline2D::project

fn Spline2D::project(self : Spline2D, target : Point2, samples_per_segment? : Int) -> SplineProjection

Find the closest sampled point to a target, returning an approximate normalized parameter and the actual point on the spline.

#
Spline2D::sample

fn Spline2D::sample(self : Spline2D, parameter : Double) -> Point2

#
Spline2D::sample_by_distance

fn Spline2D::sample_by_distance(self : Spline2D, distance : Double, samples_per_segment? : Int) -> Point2

#
Spline2D::sample_many

fn Spline2D::sample_many(self : Spline2D, count : Int) -> Array[Point2] raise MotionError

#
Spline2D::segment_count

fn Spline2D::segment_count(self : Spline2D) -> Int

#
Spline2D::speed

fn Spline2D::speed(self : Spline2D, parameter : Double) -> Double

#
Spline2D::tangent

fn Spline2D::tangent(self : Spline2D, parameter : Double) -> Point2

#
Spline2D::tension

fn Spline2D::tension(self : Spline2D) -> Double

#
Spline3D

pub struct Spline3D {
points : Array[Point3]
tension : Double
closed : Bool
} derive(
Debug
)

A Catmull-Rom spline over 3D control points for camera and scene motion.

#
Spline3D::closed

fn Spline3D::closed(self : Spline3D) -> Bool

#
Spline3D::control_points

fn Spline3D::control_points(self : Spline3D) -> Array[Point3]

#
Spline3D::length

fn Spline3D::length(self : Spline3D, samples_per_segment : Int) -> Double

#
Spline3D::new

fn Spline3D::new(points : Array[Point3], tension? : Double, closed? : Bool) -> Spline3D raise MotionError

#
Spline3D::point_count

fn Spline3D::point_count(self : Spline3D) -> Int

#
Spline3D::polyline

fn Spline3D::polyline(self : Spline3D, samples_per_segment : Int) -> Array[Point3]

#
Spline3D::sample

fn Spline3D::sample(self : Spline3D, parameter : Double) -> Point3

#
Spline3D::sample_by_distance

fn Spline3D::sample_by_distance(self : Spline3D, distance : Double, samples_per_segment? : Int) -> Point3

#
Spline3D::sample_many

fn Spline3D::sample_many(self : Spline3D, count : Int) -> Array[Point3] raise MotionError

#
Spline3D::segment_count

fn Spline3D::segment_count(self : Spline3D) -> Int

#
Spline3D::speed

fn Spline3D::speed(self : Spline3D, parameter : Double) -> Double

#
Spline3D::tangent

fn Spline3D::tangent(self : Spline3D, parameter : Double) -> Point3

#
Spline3D::tension

fn Spline3D::tension(self : Spline3D) -> Double

#
SplineProjection

pub(all) struct SplineProjection {
parameter : Double
distance : Double
value : Point2
error : Double
} derive(
Debug
)

A normalized projection on a spline, useful for path-following cameras.

#
SplineProjection::distance

fn SplineProjection::distance(self : SplineProjection) -> Double

#
SplineProjection::error

fn SplineProjection::error(self : SplineProjection) -> Double

#
SplineProjection::parameter

fn SplineProjection::parameter(self : SplineProjection) -> Double

#
SplineProjection::value

#
SpringSpec

pub struct SpringSpec {
stiffness : Double
damping : Double
mass : Double
initial_velocity : Double
} derive(
Debug
)

Physical parameters for a damped spring response.

#
SpringSpec::damping_ratio

fn SpringSpec::damping_ratio(self : SpringSpec) -> Double

#
SpringSpec::is_settled

fn SpringSpec::is_settled(self : SpringSpec, start : Double, end : Double, time : Double, tolerance? : Double) -> Bool

#
SpringSpec::natural_frequency

fn SpringSpec::natural_frequency(self : SpringSpec) -> Double

#
SpringSpec::sample

fn SpringSpec::sample(self : SpringSpec, start : Double, end : Double, time : Double) -> MotionSample

#
SpringSpec::sample_many

fn SpringSpec::sample_many(self : SpringSpec, start : Double, end : Double, duration : Double, count : Int) -> Array[MotionSample] raise MotionError

#
SpringSpec::settle_time

fn SpringSpec::settle_time(self : SpringSpec, tolerance? : Double) -> Double

#
SpringSpec::value_at

fn SpringSpec::value_at(self : SpringSpec, start : Double, end : Double, time : Double) -> Double

Spring position for a unit step from start to end.

#
SpringSpec::velocity_at

fn SpringSpec::velocity_at(self : SpringSpec, start : Double, end : Double, time : Double) -> Double

#
Tempo

pub struct Tempo {
beats_per_minute : Double
beat_offset : Double
} derive(
Debug
)

Beat-based timing helper for music and rhythm-driven interactions.

#
Tempo::beat_duration

fn Tempo::beat_duration(self : Tempo) -> Double

#
Tempo::beats_to_seconds

fn Tempo::beats_to_seconds(self : Tempo, beats : Double) -> Double

#
Tempo::new

fn Tempo::new(bpm : Double, beat_offset? : Double) -> Tempo raise MotionError

#
Tempo::seconds_to_beats

fn Tempo::seconds_to_beats(self : Tempo, seconds : Double) -> Double

#
TimeWarp

pub struct TimeWarp {
curve : Curve
start : Double
end : Double
speed : Double
} derive(
Debug
)

A normalized time remapping used by editors and media exporters.

#
TimeWarp::curve

fn TimeWarp::curve(self : TimeWarp) -> Curve

#
TimeWarp::duration

fn TimeWarp::duration(self : TimeWarp) -> Double

#
TimeWarp::map

fn TimeWarp::map(self : TimeWarp, time : Double) -> Double

#
TimeWarp::new

fn TimeWarp::new(curve : Curve, start : Double, end : Double, speed? : Double) -> TimeWarp raise MotionError

#
TimeWarp::unmap

fn TimeWarp::unmap(self : TimeWarp, mapped_time : Double) -> Double

Invert a timing curve with a fixed bisection budget.

#
Timeline

pub struct Timeline {
slots : Array[TrackSlot]
} derive(
Debug
)

A deterministic collection of named scalar tracks.

#
Timeline::add

fn Timeline::add(self : Timeline, slot : TrackSlot) -> Unit

#
Timeline::duration

fn Timeline::duration(self : Timeline) -> Double

#
Timeline::new

fn Timeline::new() -> Timeline

#
Timeline::remove

fn Timeline::remove(self : Timeline, name : String) -> Bool

#
Timeline::sample

fn Timeline::sample(self : Timeline, time : Double, mode? : Extrapolation) -> Array[TimelineValue]

Sample every enabled track at a timeline coordinate.

#
Timeline::sample_window

fn Timeline::sample_window(self : Timeline, config : SamplingConfig, mode? : Extrapolation) -> Array[Array[TimelineValue]]

Sample a timeline on a deterministic export grid.

#
Timeline::set_enabled

fn Timeline::set_enabled(self : Timeline, name : String, enabled : Bool) -> Bool

#
Timeline::track_count

fn Timeline::track_count(self : Timeline) -> Int

#
Timeline::tracks

fn Timeline::tracks(self : Timeline) -> Array[TrackSlot]

#
TimelineValue

pub(all) struct TimelineValue {
name : String
value : Double
} derive(
Debug
)

#
TimelineValue::name

fn TimelineValue::name(self : TimelineValue) -> String

#
TimelineValue::value

fn TimelineValue::value(self : TimelineValue) -> Double

#
TrackBuilder

pub struct TrackBuilder {
frames : Array[Keyframe]
}

A mutable builder useful for editors that add frames interactively.

#
TrackBuilder::add

fn TrackBuilder::add(self : TrackBuilder, frame : Keyframe) -> Unit

#
TrackBuilder::build

#
TrackBuilder::new

#
TrackBuilder::remove_at

fn TrackBuilder::remove_at(self : TrackBuilder, index : Int) -> Keyframe?

#
TrackBuilder::replace

fn TrackBuilder::replace(self : TrackBuilder, index : Int, frame : Keyframe) -> Bool

#
TrackSlot

pub struct TrackSlot {
name : String
track : ScalarTrack
offset : Double
enabled : Bool
} derive(
Debug
)

A named scalar track placed on a shared media timeline.

#
TrackSlot::enabled

fn TrackSlot::enabled(self : TrackSlot) -> Bool

#
TrackSlot::name

fn TrackSlot::name(self : TrackSlot) -> String

#
TrackSlot::offset

fn TrackSlot::offset(self : TrackSlot) -> Double

#
TrackSlot::track

fn TrackSlot::track(self : TrackSlot) -> ScalarTrack

#
Transform2D

pub(all) struct Transform2D {
position : Point2
scale : Point2
rotation : Double
skew : Double
} derive(
Debug
)

2D affine transform represented as translation, scale, rotation and skew.

#
Transform2D::position

fn Transform2D::position(self : Transform2D) -> Point2

#
Transform2D::rotation

fn Transform2D::rotation(self : Transform2D) -> Double

#
Transform2D::scale

fn Transform2D::scale(self : Transform2D) -> Point2

#
Transform2D::skew

fn Transform2D::skew(self : Transform2D) -> Double

#
TransformKeyframe

pub struct TransformKeyframe {
time : Double
value : Transform2D
curve : Curve
} derive(
Debug
)

A transform track that interpolates translation, scale, rotation, and skew.

#
TransformTrack

pub struct TransformTrack {
frames : Array[TransformKeyframe]
shortest_rotation : Bool
} derive(
Debug
)

#
TransformTrack::duration

fn TransformTrack::duration(self : TransformTrack) -> Double

#
TransformTrack::end_time

fn TransformTrack::end_time(self : TransformTrack) -> Double

#
TransformTrack::keyframes

#
TransformTrack::length

fn TransformTrack::length(self : TransformTrack) -> Int

#
TransformTrack::new

fn TransformTrack::new(frames : Array[TransformKeyframe], shortest_rotation? : Bool) -> TransformTrack raise MotionError

#
TransformTrack::sample

fn TransformTrack::sample(self : TransformTrack, time : Double, mode? : Extrapolation) -> Transform2D

#
TransformTrack::sample_many

fn TransformTrack::sample_many(self : TransformTrack, count : Int, mode? : Extrapolation) -> Array[Transform2D] raise MotionError

#
TransformTrack::start_time

fn TransformTrack::start_time(self : TransformTrack) -> Double

#
TransportFrame

pub struct TransportFrame {
index : Int
time : Double
normalized : Double
marker_hits : Array[MarkerHit]
} derive(
Debug
)

A fixed-rate export iterator that emits frame times and marker events.

#
TransportFrame::index

fn TransportFrame::index(self : TransportFrame) -> Int

#
TransportFrame::marker_hits

fn TransportFrame::marker_hits(self : TransportFrame) -> Array[MarkerHit]

#
TransportFrame::normalized

fn TransportFrame::normalized(self : TransportFrame) -> Double

#
TransportFrame::time

fn TransportFrame::time(self : TransportFrame) -> Double

#
TransportRange

pub struct TransportRange {
start : Double
end : Double
} derive(
Debug
)

A transport window with explicit in/out points for media scrubbing.

#
TransportRange::clamp

fn TransportRange::clamp(self : TransportRange, time : Double) -> Double

#
TransportRange::contains

fn TransportRange::contains(self : TransportRange, time : Double) -> Bool

#
TransportRange::duration

fn TransportRange::duration(self : TransportRange) -> Double

#
TransportRange::end

fn TransportRange::end(self : TransportRange) -> Double

#
TransportRange::normalized

fn TransportRange::normalized(self : TransportRange, time : Double) -> Double

#
TransportRange::start

fn TransportRange::start(self : TransportRange) -> Double

#
TransportStatus

pub(all) enum TransportStatus {
Stopped
Playing
Paused
Finished
} derive(Eq,
Debug
)

#
Tween

pub struct Tween {
from : Double
to : Double
duration : Double
delay : Double
repeat_count : Int
mode : Extrapolation
curve : Curve
} derive(
Debug
)

A scalar tween with delay, repeats, and optional ping-pong direction.

#
Tween::delay

fn Tween::delay(self : Tween) -> Double

#
Tween::duration

fn Tween::duration(self : Tween) -> Double

#
Tween::from

fn Tween::from(self : Tween) -> Double

#
Tween::new

fn Tween::new(from : Double, to : Double, duration : Double, delay? : Double, repeat_count? : Int, mode? : Extrapolation, curve? : Curve) -> Tween raise MotionError

#
Tween::repeat_count

fn Tween::repeat_count(self : Tween) -> Int

#
Tween::sample

fn Tween::sample(self : Tween, time : Double) -> TweenSample

Sample a tween at wall-clock time. Time and duration use the same units.

#
Tween::sample_many

fn Tween::sample_many(self : Tween, count : Int) -> Array[TweenSample] raise MotionError

#
Tween::sample_motion

fn Tween::sample_motion(self : Tween, time : Double) -> MotionSample

#
Tween::to

fn Tween::to(self : Tween) -> Double

#
Tween::total_duration

fn Tween::total_duration(self : Tween) -> Double

#
Tween::value_at

fn Tween::value_at(self : Tween, time : Double) -> Double

#
Tween::velocity_at

fn Tween::velocity_at(self : Tween, time : Double) -> Double

#
TweenSample

pub(all) struct TweenSample {
time : Double
value : Double
progress : Double
cycle : Int
state : TweenState
} derive(
Debug
)

A value sample with enough metadata for a renderer or UI state machine.

#
TweenSample::cycle

fn TweenSample::cycle(self : TweenSample) -> Int

#
TweenSample::progress

fn TweenSample::progress(self : TweenSample) -> Double

#
TweenSample::state

fn TweenSample::state(self : TweenSample) -> TweenState

#
TweenSample::value

fn TweenSample::value(self : TweenSample) -> Double

#
TweenSequence

pub struct TweenSequence {
tweens : Array[Tween]
gap : Double
} derive(
Debug
)

A serial composition of Tweens with optional gaps between segments.

#
TweenSequence::duration

fn TweenSequence::duration(self : TweenSequence) -> Double

#
TweenSequence::gap

fn TweenSequence::gap(self : TweenSequence) -> Double

#
TweenSequence::length

fn TweenSequence::length(self : TweenSequence) -> Int

#
TweenSequence::new

fn TweenSequence::new(tweens : Array[Tween], gap? : Double) -> TweenSequence raise MotionError

#
TweenSequence::sample

fn TweenSequence::sample(self : TweenSequence, time : Double) -> SequenceSample

Sample the sequence in wall-clock time. A gap holds the previous value.

#
TweenSequence::sample_many

fn TweenSequence::sample_many(self : TweenSequence, count : Int) -> Array[SequenceSample] raise MotionError

#
TweenSequence::tweens

fn TweenSequence::tweens(self : TweenSequence) -> Array[Tween]

#
TweenSequence::value_at

fn TweenSequence::value_at(self : TweenSequence, time : Double) -> Double

#
TweenState

pub(all) enum TweenState {
Before
Active
After
} derive(Eq,
Debug
)

Lifecycle state of a tween sample.

#
adaptive_sample

fn adaptive_sample(func : (Double) -> Double, start : Double, end : Double, config : AdaptiveSamplingConfig) -> AdaptiveSampleResult raise MotionError

Recursively sample a scalar curve where curvature exceeds a tolerance.

#
adaptive_sample_tween

fn adaptive_sample_tween(tween : Tween, start : Double, end : Double, config : AdaptiveSamplingConfig) -> AdaptiveSampleResult raise MotionError

#
all_easings

fn all_easings() -> Array[EasingId]

Enumerate the built-ins in a stable order for editors and documentation.

#
analyze_bezier

fn analyze_bezier(curve : Bezier, samples : Int) -> CurveReport

#
analyze_easing

fn analyze_easing(func : (Double) -> Double, samples : Int) -> CurveReport

Inspect an arbitrary easing function using a fixed normalized grid.

#
analyze_easing_id

fn analyze_easing_id(id : EasingId, samples : Int) -> CurveReport

#
analyze_samples

fn analyze_samples(samples : Array[SamplePoint]) -> Array[CurveAnalysisPoint]

#
back_in

fn back_in(t : Double, overshoot? : Double) -> Double

Back easing with configurable overshoot.

#
back_in_out

fn back_in_out(t : Double, overshoot? : Double) -> Double

#
back_out

fn back_out(t : Double, overshoot? : Double) -> Double

#
bezier_clamped

fn bezier_clamped(x1 : Double, y1 : Double, x2 : Double, y2 : Double) -> Bezier

Construct a curve while clamping its x controls to the CSS-valid range.

#
blend

fn blend(first : (Double) -> Double, second : (Double) -> Double, amount~ : Double) -> ((Double) -> Double)

Blend two curves with an amount in the closed interval [0, 1].

#
blend_bundles

fn blend_bundles(first : ScalarTrackBundle, second : ScalarTrackBundle, amount : Double) -> ScalarTrackBundle raise MotionError

Blend two bundles by channel name. Missing channels are carried through from the bundle that contains them.

#
blend_values

fn blend_values(first : Array[Double], second : Array[Double], amount : Double) -> Array[Double]

#
bounce_in

fn bounce_in(t : Double) -> Double

#
bounce_in_out

fn bounce_in_out(t : Double) -> Double

#
bounce_out

fn bounce_out(t : Double) -> Double

Piecewise quadratic bounce used for UI and game motion.

#
catmull_rom

fn catmull_rom(previous : Double, start : Double, end : Double, next : Double, t : Double, tension? : Double) -> Double

Catmull-Rom interpolation across four scalar samples.

#
catmull_rom_array

fn catmull_rom_array(values : Array[Double], position : Double) -> Double

Cubic interpolation over a value array using clamped endpoint samples.

#
catmull_rom_point2

fn catmull_rom_point2(previous : Point2, start : Point2, end : Point2, next : Point2, t : Double, tension? : Double) -> Point2

#
catmull_rom_point3

fn catmull_rom_point3(previous : Point3, start : Point3, end : Point3, next : Point3, t : Double, tension? : Double) -> Point3

#
circ_in

fn circ_in(t : Double) -> Double

#
circ_in_out

fn circ_in_out(t : Double) -> Double

#
circ_out

fn circ_out(t : Double) -> Double

#
clamp01

fn clamp01(value : Double) -> Double

#
clamp_values

fn clamp_values(values : Array[Double], bounds : MotionBounds) -> Array[Double]

#
classify_monotonicity

fn classify_monotonicity(samples : Array[SamplePoint], tolerance? : Double) -> CurveMonotonicity

#
compose

fn compose(outer : (Double) -> Double, inner : (Double) -> Double) -> ((Double) -> Double)

Compose two curves. outer(inner(t)) is evaluated without intermediate arrays.

#
compose_retime

fn compose_retime(first : RetimeMap, second : RetimeMap, samples_per_segment? : Int) -> RetimeMap raise MotionError

#
convolve_signal

fn convolve_signal(signal : MotionSignal, kernel : Array[Double]) -> MotionSignal

Convolve a signal with a finite kernel, using edge replication.

#
critically_damped_step

fn critically_damped_step(current : Double, target : Double, velocity : Double, response : Double, delta_time : Double) -> (Double, Double)

#
cubic_in

fn cubic_in(t : Double) -> Double

Cubic acceleration.

#
cubic_in_out

fn cubic_in_out(t : Double) -> Double

Cubic acceleration followed by deceleration.

#
cubic_out

fn cubic_out(t : Double) -> Double

Cubic deceleration.

#
cubic_path2d

fn cubic_path2d(start : Point2, control_start : Point2, control_end : Point2, end : Point2) -> CubicPath2D

#
cumulative_integral

fn cumulative_integral(signal : MotionSignal) -> MotionSignal

#
curve_lookup

fn curve_lookup(func : (Double) -> Double, start : Double, end : Double, count : Int) -> Array[SamplePoint] raise MotionError

Generate a lookup table with an explicit endpoint policy.

#
curve_maximum

fn curve_maximum(samples : Array[SamplePoint]) -> SamplePoint?

#
curve_minimum

fn curve_minimum(samples : Array[SamplePoint]) -> SamplePoint?

#
decimate_samples

fn decimate_samples(samples : Array[SamplePoint], stride : Int) -> Array[SamplePoint]

Downsample a sample array by keeping every nth frame and preserving the end.

#
derivative_of

fn derivative_of(func : (Double) -> Double, t : Double, step? : Double) -> Double

Numerically estimate a first derivative without allocating a sample buffer.

#
differentiate

fn differentiate(values : Array[Double], step : Double) -> Array[Double]

First difference of a sampled signal with an explicit time step.

#
differentiate_signal

fn differentiate_signal(signal : MotionSignal) -> MotionSignal

Differentiate a signal using central differences in the interior.

#
easing

fn easing(id : EasingId) -> ((Double) -> Double)

Return a first-class easing function for use in a sampler or a custom blend.

#
elastic_in

fn elastic_in(t : Double, amplitude? : Double, period? : Double) -> Double

Elastic acceleration. Amplitude and period are normalized motion controls.

#
elastic_in_out

fn elastic_in_out(t : Double, amplitude? : Double, period? : Double) -> Double

#
elastic_out

fn elastic_out(t : Double, amplitude? : Double, period? : Double) -> Double

#
enforce_monotonic

fn enforce_monotonic(values : Array[Double], increasing : Bool) -> Array[Double]

#
expo_in

fn expo_in(t : Double) -> Double

#
expo_in_out

fn expo_in_out(t : Double) -> Double

#
expo_out

fn expo_out(t : Double) -> Double

#
first_crossing

fn first_crossing(samples : Array[SamplePoint], target : Double) -> Double?

Find the first time at which a sorted curve reaches a target value.

#
gradient_stop

fn gradient_stop(position : Double, color : Rgba, curve? : Curve) -> GradientStop raise MotionError

#
hermite

fn hermite(start : Double, end : Double, tangent_start : Double, tangent_end : Double, t : Double) -> Double

Cubic Hermite interpolation. Tangents use the same units as values.

#
hsv

fn hsv(hue~ : Double, saturation~ : Double, value~ : Double, alpha? : Double) -> Hsv

#
integrate_analyzed_curve

fn integrate_analyzed_curve(samples : Array[SamplePoint]) -> Double

Estimate the signed area under a curve using the trapezoidal rule.

#
integrate_curve

fn integrate_curve(func : (Double) -> Double, samples : Int) -> Double

Integrate a normalized curve with the trapezoid rule.

#
integrate_samples

fn integrate_samples(samples : Array[SamplePoint]) -> Double

Approximate the integral of a sampled scalar signal with trapezoids.

#
integrate_signal

fn integrate_signal(signal : MotionSignal) -> Double

#
interpolate_angle

fn interpolate_angle(start : Double, end : Double, t : Double) -> Double

Interpolate an angle in radians along the shortest path.

#
interpolate_hsv

fn interpolate_hsv(start : Hsv, end : Hsv, t : Double) -> Hsv

#
interpolate_point2

fn interpolate_point2(start : Point2, end : Point2, t : Double) -> Point2

#
interpolate_point3

fn interpolate_point3(start : Point3, end : Point3, t : Double) -> Point3

#
interpolate_rgba

fn interpolate_rgba(start : Rgba, end : Rgba, t : Double, premultiplied? : Bool) -> Rgba

Interpolate straight in RGBA space, optionally preserving premultiplied alpha.

#
interpolate_rgba_hsv

fn interpolate_rgba_hsv(start : Rgba, end : Rgba, t : Double) -> Rgba

#
interpolate_samples

fn interpolate_samples(samples : Array[AdaptiveSamplePoint], time : Double) -> Double

Linear interpolation over a sorted adaptive sample.

#
interpolate_scalar

fn interpolate_scalar(start : Double, end : Double, t : Double) -> Double

Scalar interpolation primitive.

#
interpolate_transform

fn interpolate_transform(start : Transform2D, end : Transform2D, t : Double, shortest_rotation? : Bool) -> Transform2D

#
keyframe

fn keyframe(time : Double, value : Double, curve? : Curve) -> Keyframe raise MotionError

#
linear

fn linear(t : Double) -> Double

Linear interpolation with no acceleration.

#
local_maxima

fn local_maxima(samples : Array[SamplePoint], prominence : Double) -> Array[SamplePoint] raise MotionError

Keep local maxima with a configurable minimum prominence.

#
lookup_value

fn lookup_value(samples : Array[SamplePoint], time : Double) -> Double

Evaluate a table with linear interpolation and clamped boundaries.

#
low_pass_signal

fn low_pass_signal(signal : MotionSignal, alpha : Double) -> MotionSignal

Apply a first-order exponential low-pass filter.

#
map_curve_range

fn map_curve_range(samples : Array[SamplePoint], output_min : Double, output_max : Double) -> Array[SamplePoint]

Compose a source curve with an output range.

#
marker

fn marker(time : Double, name : String, payload? : String) -> MotionMarker raise MotionError

#
marker_cursor

fn marker_cursor(timeline : MarkerTimeline, start_time? : Double) -> MarkerCursor

#
marker_sequence

fn marker_sequence(names : Array[String], start : Double, interval : Double) -> MarkerTimeline raise MotionError

Build a timeline from a regular sequence of marker names.

#
maximum_sample_error

fn maximum_sample_error(first : Array[SamplePoint], second : Array[SamplePoint]) -> Double

Return the largest absolute error between two aligned sample arrays.

#
mean

fn mean(values : Array[Double]) -> Double

#
median

fn median(values : Array[Double]) -> Double

#
mirror

fn mirror(ease : (Double) -> Double) -> ((Double) -> Double)

Reflect a curve around the center point, useful for reversible UI motion.

#
monotone_envelope

fn monotone_envelope(values : Array[Double]) -> Array[Double]

Clamp a signal to a monotone non-decreasing envelope.

#
motion_clip

fn motion_clip(name : String, track : ScalarTrack, markers? : MarkerTimeline, loop_mode? : ClipLoopMode) -> MotionClip raise MotionError

#
motion_profile

fn motion_profile(func : (Double) -> Double, samples : Int) -> Array[MotionSample] raise MotionError

Produce value, velocity, and acceleration samples for a normalized curve.

#
motion_state

fn motion_state(name : String, value : Double) -> MotionStateNode raise MotionError

#
motion_transition

fn motion_transition(from : String, to : String, duration : Double, curve? : Curve) -> MotionStateTransition raise MotionError

#
moving_average

fn moving_average(values : Array[Double], window : Int) -> Array[Double]

Moving-average smoothing for an already sampled scalar signal.

#
normalize_samples

fn normalize_samples(values : Array[Double]) -> Array[Double]

Normalize a signal to [0, 1]. Constant signals map to zero.

#
normalize_signal

fn normalize_signal(signal : MotionSignal) -> MotionSignal

#
path_builder2d

fn path_builder2d(start : Point2) -> PathBuilder2D

#
path_cubic

fn path_cubic(start : Point2, control_start : Point2, control_end : Point2, end : Point2) -> PathSegment2D

#
path_line

fn path_line(start : Point2, end : Point2) -> PathSegment2D

#
peak_index

fn peak_index(values : Array[Double]) -> Int?

#
percentile

fn percentile(values : Array[Double], ratio : Double) -> Double

Compute a percentile value from a copied and sorted scalar array.

#
point2

fn point2(x~ : Double, y~ : Double) -> Point2

#
point2_angle

fn point2_angle(first : Point2, second : Point2) -> Double

#
point2_cross

fn point2_cross(first : Point2, second : Point2) -> Double

#
point2_dot

fn point2_dot(first : Point2, second : Point2) -> Double

Dot product for planar tangent and normal calculations.

#
point2_from_polar

fn point2_from_polar(radius : Double, angle : Double) -> Point2

#
point2_keyframe

fn point2_keyframe(time : Double, value~ : Point2, curve? : Curve) -> Point2Keyframe raise MotionError

#
point2_length

fn point2_length(value : Point2) -> Double

#
point2_lerp_clamped

fn point2_lerp_clamped(first : Point2, second : Point2, ratio : Double) -> Point2

#
point2_normal

fn point2_normal(value : Point2) -> Point2

#
point2_normalized

fn point2_normalized(value : Point2) -> Point2

#
point2_reflect

fn point2_reflect(value : Point2, normal : Point2) -> Point2

#
point3

fn point3(x~ : Double, y~ : Double, z~ : Double) -> Point3

#
point3_cross

fn point3_cross(first : Point3, second : Point3) -> Point3

#
point3_distance

fn point3_distance(first : Point3, second : Point3) -> Double

#
point3_dot

fn point3_dot(first : Point3, second : Point3) -> Double

#
point3_keyframe

fn point3_keyframe(time : Double, value~ : Point3, curve? : Curve) -> Point3Keyframe raise MotionError

#
point3_length

fn point3_length(value : Point3) -> Double

#
point3_lerp_clamped

fn point3_lerp_clamped(first : Point3, second : Point3, ratio : Double) -> Point3

#
point3_normalized

fn point3_normalized(value : Point3) -> Point3

#
polynomial_in

fn polynomial_in(t : Double, exponent~ : Double) -> Double

Polynomial easing with a caller-selected exponent.

#
polynomial_in_out

fn polynomial_in_out(t : Double, exponent~ : Double) -> Double

#
polynomial_out

fn polynomial_out(t : Double, exponent~ : Double) -> Double

#
quad_in

fn quad_in(t : Double) -> Double

Quadratic acceleration.

#
quad_in_out

fn quad_in_out(t : Double) -> Double

Quadratic acceleration followed by deceleration.

#
quad_out

fn quad_out(t : Double) -> Double

Quadratic deceleration.

#
quantize_to_grid

fn quantize_to_grid(time : Double, step : Double) -> Double

#
quart_in

fn quart_in(t : Double) -> Double

Quartic acceleration.

#
quart_in_out

fn quart_in_out(t : Double) -> Double

Quartic acceleration followed by deceleration.

#
quart_out

fn quart_out(t : Double) -> Double

Quartic deceleration.

#
quint_in

fn quint_in(t : Double) -> Double

Quintic acceleration.

#
quint_in_out

fn quint_in_out(t : Double) -> Double

Quintic acceleration followed by deceleration.

#
quint_out

fn quint_out(t : Double) -> Double

Quintic deceleration.

#
remap_times

fn remap_times(times : Array[Double], warp : TimeWarp) -> Array[Double]

#
remap_value

fn remap_value(value : Double, source_min : Double, source_max : Double, target_min : Double, target_max : Double) -> Double

#
resample_adaptive

fn resample_adaptive(result : AdaptiveSampleResult, count : Int) -> Array[SamplePoint] raise MotionError

Resample an adaptive result at a fixed number of output points.

#
resample_signal

fn resample_signal(signal : MotionSignal, step : Double) -> MotionSignal raise MotionError

Resample at a new step while preserving the signal's time span.

#
rescale_time

fn rescale_time(samples : Array[SamplePoint], start : Double, end : Double) -> Array[SamplePoint]

#
retime_linear

fn retime_linear(input_start : Double, input_end : Double, output_start : Double, output_end : Double) -> RetimeMap raise MotionError

#
retime_segment

fn retime_segment(input_start : Double, input_end : Double, output_start : Double, output_end : Double, curve? : Curve) -> RetimeSegment raise MotionError

#
reverse_samples

fn reverse_samples(samples : Array[SamplePoint]) -> Array[SamplePoint]

Reverse the time direction while preserving the original sample order in the returned array, making it convenient for playback direction toggles.

#
rgba

fn rgba(r~ : Double, g~ : Double, b~ : Double, a? : Double) -> Rgba

#
rgba_keyframe

fn rgba_keyframe(time : Double, value~ : Rgba, curve? : Curve) -> RgbaKeyframe raise MotionError

#
rms

fn rms(values : Array[Double]) -> Double

#
sample_function

fn sample_function(func : (Double) -> Double, start : Double, end : Double, count : Int) -> Array[SamplePoint] raise MotionError

Sample a function on a uniform grid. This is useful for waveform and curve previews.

#
sample_track

fn sample_track(track : ScalarTrack, config : SamplingConfig, mode? : Extrapolation) -> Array[SamplePoint]

#
sample_tween

fn sample_tween(tween : Tween, config : SamplingConfig) -> Array[SamplePoint]

#
scalar_channel

fn scalar_channel(name : String, track : ScalarTrack, enabled? : Bool, weight? : Double, offset? : Double) -> ScalarChannel raise MotionError

#
scale_markers

fn scale_markers(timeline : MarkerTimeline, factor : Double) -> MarkerTimeline raise MotionError

Return a copy with marker times scaled around the origin.

#
sequence_item

fn sequence_item(clip : MotionClip, start : Double, weight? : Double) -> ClipSequenceItem raise MotionError

#
shift_markers

fn shift_markers(timeline : MarkerTimeline, offset : Double) -> MarkerTimeline raise MotionError

Return a copy with all marker times shifted by an offset.

#
signal_energy

fn signal_energy(signal : MotionSignal) -> Double

#
signal_maximum

fn signal_maximum(signal : MotionSignal) -> Double?

#
signal_minimum

fn signal_minimum(signal : MotionSignal) -> Double?

#
signal_rms

fn signal_rms(signal : MotionSignal) -> Double

#
signal_to_samples

fn signal_to_samples(signal : MotionSignal) -> Array[SamplePoint]

#
simplify_samples

fn simplify_samples(samples : Array[SamplePoint], tolerance : Double) -> Array[SamplePoint] raise MotionError

Remove samples that are within a scalar tolerance of their chord.

#
sine_in

fn sine_in(t : Double) -> Double

Sine acceleration.

#
sine_in_out

fn sine_in_out(t : Double) -> Double

Sine acceleration followed by deceleration.

#
sine_out

fn sine_out(t : Double) -> Double

Sine deceleration.

#
smooth_damp

fn smooth_damp(current : Double, target : Double, velocity : Double, smooth_time : Double, delta_time : Double) -> (Double, Double)

#
smooth_signal

fn smooth_signal(signal : MotionSignal, radius : Int) -> MotionSignal

Create a centered moving average; edge windows are shortened rather than padded, avoiding artificial impulses at clip boundaries.

#
soft_limit

fn soft_limit(value : Double, minimum : Double, maximum : Double, softness : Double) -> Double

Apply a soft saturation instead of a hard clamp near both bounds.

#
spring_spec

fn spring_spec(stiffness : Double, damping : Double, mass? : Double, initial_velocity? : Double) -> SpringSpec raise MotionError

#
stagger

fn stagger(count : Int, delay : Double, interval : Double) -> Array[Double]

#
standard_deviation

fn standard_deviation(values : Array[Double]) -> Double

#
threshold_crossings

fn threshold_crossings(samples : Array[SamplePoint], threshold : Double) -> Array[Double] raise MotionError

Find crossings of a scalar threshold, using linear interpolation in each span.

#
total_variation

fn total_variation(samples : Array[SamplePoint]) -> Double

Estimate total variation, which is useful for quantizing a motion signal.

#
track_slot

fn track_slot(name : String, track : ScalarTrack, offset? : Double, enabled? : Bool) -> TrackSlot

#
transform2d

fn transform2d(position~ : Point2, scale~ : Point2, rotation~ : Double, skew? : Double) -> Transform2D

#
transform_keyframe

fn transform_keyframe(time : Double, value~ : Transform2D, curve? : Curve) -> TransformKeyframe raise MotionError

#
transport_frame_count

fn transport_frame_count(range : TransportRange, frame_rate : Double) -> Int

#
transport_frames

fn transport_frames(range : TransportRange, frame_rate : Double, markers? : MarkerTimeline) -> Array[TransportFrame] raise MotionError

#
transport_progress

fn transport_progress(range : TransportRange, time : Double) -> Double

#
transport_range

fn transport_range(start : Double, end : Double) -> TransportRange raise MotionError

#
transport_time_at_frame

fn transport_time_at_frame(range : TransportRange, frame_rate : Double, frame : Int) -> Double

#
variance

fn variance(values : Array[Double]) -> Double