A dependency-free MoonBit motion toolkit for media timelines, easing curves, cubic Bezier inversion, and scalar keyframes.
moon add Zlj6566/moonbit-easings///|
import {
"Zlj6566/moonbit-easings" @easings,
}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())# 展示 Tween、关键帧、颜色渐变和序列组合
moon run cmd/demo
# 运行可复现的 Native 工作负载并打印校验和
moon run --target native --release cmd/benchEasing / Bezier
│
├── Tween / Keyframe / ScalarTrack
│ │
│ ├── Timeline / Bundle / StateMachine
│ └── Clip / Sequence / Transport / Markers
│
├── Point / Color / Transform Tracks
├── Spline / Path / RetimeMap
└── Sampling / Signal / Diagnosticsmoon build --target native --release cmd/bench
moon run --target native --release cmd/benchmoon 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 allpub(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
}pub(all) struct AdaptiveSampleResult {
points : Array[AdaptiveSamplePoint]
accepted_segments : Int
rejected_segments : Int
maximum_error : Double
} derive(Debug)pub struct AdaptiveSamplingConfig {
tolerance : Double
max_depth : Int
max_samples : Int
} derive(Debug)fn AdaptiveSamplingConfig::new(tolerance : Double, max_depth? : Int, max_samples? : Int) -> AdaptiveSamplingConfig raise MotionErrorpub struct Affine2D {
a : Double
b : Double
c : Double
d : Double
tx : Double
ty : Double
} derive(Debug)pub struct BeatCue {
beat : Double
label : String
duration : Double
strength : Double
} derive(Debug)pub struct BeatGrid {
tempo : TempoTimeline
signature : TimeSignature2
groove : GroovePattern
} derive(Debug)fn Bezier::new(x1 : Double, y1 : Double, x2 : Double, y2 : Double, sample_count? : Int) -> Bezier raise MotionErrorpub enum BlendMode {
Normal
Multiply
Screen
Overlay
Additive
Subtract
Darken
Lighten
Difference
ColorDodge
ColorBurn
} derive(Debug)pub struct CachePool2 {
scalar : Array[ScalarSampleCache2]
point : Array[PointSampleCache2]
color : Array[ColorSampleCache2]
capacity : Int
} derive(Debug)pub struct CameraFraming2 {
center : Point3
radius : Double
policy : FramingPolicy2
margin : Double
} derive(Debug)pub struct CameraKeyframe {
time : Double
pose : CameraPose
lens : CameraLens
curve : Curve
} derive(Debug)pub struct CameraLens {
model : ProjectionModel
field_of_view : Double
orthographic_height : Double
near_plane : Double
far_plane : Double
aperture : Double
focus_distance : Double
} derive(Debug)fn CameraPostSettings2::with_exposure(self : CameraPostSettings2, value : Double) -> CameraPostSettings2fn CameraPostSettings2::with_focus(self : CameraPostSettings2, value : Double) -> CameraPostSettings2fn CameraPostSettings2::with_safe_margin(self : CameraPostSettings2, value : Double) -> CameraPostSettings2fn CameraPostSettings2::with_shake(self : CameraPostSettings2, value : Point2) -> CameraPostSettings2fn CameraPostSettings2::with_vignette(self : CameraPostSettings2, value : Double) -> CameraPostSettings2pub struct CameraRig {
pose : CameraPose
lens : CameraLens
viewport : Viewport
jitter : Point2
} derive(Debug)fn CameraTrack::new(frames : Array[CameraKeyframe], viewport : Viewport) -> CameraTrack raise MotionErrorfn ClipSequence::markers_between(self : ClipSequence, start : Double, end : Double) -> Array[MarkerHit]fn ClipSequence::sample_many(self : ClipSequence, count : Int) -> Array[SamplePoint] raise MotionErrorfn ClipSequenceBuilder::add(self : ClipSequenceBuilder, item : ClipSequenceItem) -> ClipSequenceBuilderfn ClipSequenceBuilder::add_at(self : ClipSequenceBuilder, clip : MotionClip, start : Double, weight? : Double) -> ClipSequenceBuilder raise MotionErrorfn ColorGradient::new(stops : Array[GradientStop], premultiplied? : Bool) -> ColorGradient raise MotionErrorpub struct ColorMatrix {
red : (Double, Double, Double, Double, Double)
green : (Double, Double, Double, Double, Double)
blue : (Double, Double, Double, Double, Double)
alpha : (Double, Double, Double, Double, Double)
} derive(Debug)pub struct ColorRamp2 {
stops : Array[ColorRampStop]
interpolation : RampInterpolation
} derive(Debug)pub struct ConstraintResult2 {
value : Double
velocity : Double
acceleration : Double
status : ConstraintStatus2
iterations : Int
error : Double
} derive(Debug)pub struct ConstraintSolveConfig {
frame_rate : Double
limits : MotionLimitProfile2
preserve_endpoints : Bool
passes : Int
} derive(Debug)fn ConstraintSolveConfig::with_endpoints(self : ConstraintSolveConfig, preserve : Bool) -> ConstraintSolveConfigfn ConstraintSolveConfig::with_passes(self : ConstraintSolveConfig, passes : Int) -> ConstraintSolveConfigpub enum ConstraintStatus2 {
ConstraintSatisfied
VelocityLimited
AccelerationLimited
JerkLimited
PositionClamped
} derive(Debug)fn CubicPath2D::sample_by_distance(self : CubicPath2D, distance : Double, segments? : Int) -> Point2pub(all) struct CurveAnalysisPoint {
time : Double
value : Double
velocity : Double
acceleration : Double
normalized_value : Double
} derive(Debug)pub struct CurveComparison {
mean_absolute_error : Double
root_mean_square_error : Double
maximum_error : Double
area_error : Double
correlation : Double
samples : Int
} derive(Debug)pub enum CurveFeature {
FeatureStart
FeatureEnd
FeaturePeakVelocity
FeaturePeakAcceleration
FeatureFirstOvershoot
FeatureSettlingTime
} derive(Debug)pub struct CurveInvariantReport2 {
start_error : Double
end_error : Double
maximum_step : Double
monotonic : Bool
finite : Bool
samples : Int
} derive(Debug)fn CurveLookupTable::map_range(self : CurveLookupTable, input : Double, output_min : Double, output_max : Double) -> Doublefn CurveLookupTable::resample(self : CurveLookupTable, samples : Int) -> CurveLookupTable raise MotionErrorfn CurveLutBank::add(self : CurveLutBank, label : String, curve : Curve, samples : Int) -> Unit raise MotionErrorpub struct CurveRemap2 {
input_min : Double
input_max : Double
output_min : Double
output_max : Double
extrapolation : Extrapolation
} derive(Debug)pub(all) struct CurveReport {
samples : Int
minimum : Double
maximum : Double
endpoint_error : Double
monotonic : Bool
peak_velocity : Double
peak_acceleration : Double
} derive(Debug)pub enum CurveStage2 {
StageNormalize
StageClamp(Double, Double)
StageRemap(Double, Double)
StageBias(Double)
StageGain(Double)
StageQuantize(Int)
StageMirror
} derive(Debug)pub struct CurveStatistics {
minimum : Double
maximum : Double
mean : Double
integral : Double
peak_velocity : Double
peak_acceleration : Double
total_variation : Double
overshoot : Double
undershoot : Double
} derive(Debug)pub enum DiagnosticCode2 {
EmptyInputDiagnostic
NonFiniteDiagnostic
EndpointMismatchDiagnostic
VelocityLimitDiagnostic
SamplingErrorDiagnostic
ColorRangeDiagnostic
BoundsDiagnostic
} derive(Debug)pub struct DiagnosticIssue2 {
severity : DiagnosticSeverity2
code : DiagnosticCode2
message : String
sample_index : Int
value : Double
limit : Double
} derive(Debug)pub struct DiagnosticReport2 {
name : String
issues : Array[DiagnosticIssue2]
checked_samples : Int
duration : Double
} derive(Debug)fn DiagnosticReport2::with_measurements(self : DiagnosticReport2, samples : Int, duration : Double) -> DiagnosticReport2pub struct DiagnosticSummary2 {
reports : Int
errors : Int
warnings : Int
samples : Int
} derive(Debug)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)pub struct EvaluationContext2 {
time : Double
frame : Int
normalized : Double
delta : Double
direction : Int
} derive(Debug)pub struct EvaluationStats2 {
frames : Int
active_nodes : Int
render_passes : Int
events : Int
duration : Double
} derive(Debug)pub struct EventWindow2 {
start : Double
end : Double
events : Array[MotionEvent2]
crossed_forward : Bool
} derive(Debug)pub struct ExportChunk2 {
start_frame : Int
end_frame : Int
start_time : Double
end_time : Double
bytes : Int
} derive(Debug)pub struct ExportManifest2 {
settings : ExportSettings2
entries : Array[ExportManifestEntry2]
version : Int
} derive(Debug)pub struct ExportManifestEntry2 {
id : Int
name : String
start : Double
end : Double
checksum : Int
frame_count : Int
} derive(Debug)fn ExportManifestEntry2::with_checksum(self : ExportManifestEntry2, checksum : Int) -> ExportManifestEntry2pub struct ExportSettings2 {
format : ExportFormat2
width : Int
height : Int
frame_rate : Double
quality : RenderQuality2
premultiplied : Bool
} derive(Debug)fn ExportSettings2::with_quality(self : ExportSettings2, quality : RenderQuality2) -> ExportSettings2pub struct FrameBudget2 {
frame_count : Int
frame_bytes : Int
total_bytes : Int
duration : Double
throughput : Double
} derive(Debug)pub enum FrameChannel2 {
ScalarChannel
Point2Channel
Point3Channel
ColorChannel
Transform3Channel
} derive(Debug)pub struct FrameDropReport2 {
expected : Int
actual : Int
missing : Int
duplicate : Int
maximum_gap : Int
} derive(Debug)pub struct FrameSchedule2 {
start : Double
end : Double
frame_rate : Double
first_frame : Int
} derive(Debug)pub enum FramingPolicy2 {
FitWidthFraming
FitHeightFraming
FitBoundsFraming
FillBoundsFraming
} derive(Debug)pub struct JitterSequence2 {
source : NoiseSource2
amplitude : Point2
frequency : Double
phase : Point2
} derive(Debug)fn JitterSequence2::sample_many(self : JitterSequence2, start : Double, step : Double, count : Int) -> Array[Point2]pub struct KeyframeCleanupReport {
removed : Int
merged : Int
adjusted : Int
maximum_adjustment : Double
} derive(Debug)fn MarkerTimeline::at(self : MarkerTimeline, time : Double, tolerance? : Double) -> Array[MotionMarker]pub(all) struct Matrix4 {
m00 : Double
m01 : Double
m02 : Double
m03 : Double
m10 : Double
m11 : Double
m12 : Double
m13 : Double
m20 : Double
m21 : Double
m22 : Double
m23 : Double
m30 : Double
m31 : Double
m32 : Double
m33 : Double
} derive(Debug)pub struct MediaAsset2 {
id : Int
name : String
kind : MediaKind2
start : Double
duration : Double
bounds : Bounds2D
tags : Array[String]
enabled : Bool
} derive(Debug)pub struct MotionBudget2 {
maximum_speed : Double
maximum_acceleration : Double
maximum_path_length : Double
} derive(Debug)pub struct MotionClip {
name : String
track : ScalarTrack
markers : MarkerTimeline
loop_mode : ClipLoopMode
} derive(Debug)pub struct MotionEvent2 {
time : Double
id : Int
label : String
kind : MotionEventKind2
payload : Double
consumed : Bool
} derive(Debug)pub struct MotionEventQueue2 {
events : Array[MotionEvent2]
cursor : Int
last_time : Double
} derive(Debug)fn MotionEventQueue2::poll_window(self : MotionEventQueue2, start : Double, end : Double) -> Array[MotionEvent2]pub struct MotionLimitProfile2 {
maximum_velocity : Double
maximum_acceleration : Double
maximum_jerk : Double
tolerance : Double
iterations : Int
} derive(Debug)pub struct MotionMetrics2 {
path_length : Double
peak_speed : Double
peak_acceleration : Double
average_speed : Double
settled_time : Double
samples : Int
} derive(Debug)pub struct MotionReport2 {
name : String
metrics : Array[Double]
budget : MotionBudget2
quality : RenderQualityMetrics2
passed : Bool
} derive(Debug)pub(all) struct MotionSample {
time : Double
value : Double
velocity : Double
acceleration : Double
} derive(Debug)fn MotionSignal::new(values : Array[Double], start : Double, step : Double) -> MotionSignal raise MotionErrorfn MotionSignal::sample_many(self : MotionSignal, count : Int) -> Array[SamplePoint] raise MotionErrorfn MotionSignal::zip_map(self : MotionSignal, other : MotionSignal, func : (Double, Double) -> Double) -> MotionSignalpub 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)fn MotionStateMachine::add_state(self : MotionStateMachine, state : MotionStateNode) -> Unit raise MotionErrorfn MotionStateMachine::add_transition(self : MotionStateMachine, transition : MotionStateTransition) -> Unit raise MotionErrorfn MotionStateMachine::new(states : Array[MotionStateNode], transitions? : Array[MotionStateTransition], initial? : String) -> MotionStateMachine raise MotionErrorfn MotionStateMachine::transition_to(self : MotionStateMachine, target : String, now : Double, duration? : Double, curve? : Curve) -> Unit raise MotionErrorpub struct MotionTransport {
position : Double
speed : Double
status : TransportStatus
direction : PlaybackDirection
range : TransportRange
markers : MarkerTimeline
} derive(Debug)fn MotionTransport::advance(self : MotionTransport, delta_seconds : Double) -> Array[MarkerHit] raise MotionErrorfn MotionTransport::seek_and_collect(self : MotionTransport, position : Double) -> Array[MarkerHit] raise MotionErrorpub struct NoiseSource2 {
seed : Int
frequency : Double
octaves : Int
persistence : Double
lacunarity : Double
} derive(Debug)fn NoiseSource2::sample_many(self : NoiseSource2, count : Int, x : Double, y : Double, step : Double) -> Array[Double]pub struct Path2D {
segments : Array[PathSegment2D]
lengths : Array[Double]
total_length : Double
} derive(Debug)fn Path2D::append(self : Path2D, segment : PathSegment2D, samples_per_curve? : Int) -> Path2D raise MotionErrorfn Path2D::new(segments : Array[PathSegment2D], samples_per_curve? : Int) -> Path2D raise MotionErrorpub struct Path3D {
segments : Array[PathSegment3D]
lengths : Array[Double]
total_length : Double
} derive(Debug)fn Path3D::new(segments : Array[PathSegment3D], samples_per_curve? : Int) -> Path3D raise MotionErrorfn PathBuilder2D::cubic_to(self : PathBuilder2D, control_start : Point2, control_end : Point2, end : Point2) -> Unitfn PathBuilder3D::cubic_to(self : PathBuilder3D, control_start : Point3, control_end : Point3, end : Point3) -> Unitpub struct PathMetricProfile3D {
samples : Array[PathSample3D]
total_length : Double
maximum_curvature : Double
average_curvature : Double
} derive(Debug)pub struct Point2BlendLayer {
value : Point2
weight : Double
mode : LayerBlendMode
priority : Int
} derive(Debug)pub struct Point2ConstraintResult {
value : Point2
velocity : Point2
acceleration : Point2
status : ConstraintStatus2
error : Double
} derive(Debug)fn Point2Track::sample_many(self : Point2Track, count : Int, mode? : Extrapolation) -> Array[Point2] raise MotionErrorpub struct Point3BlendLayer {
value : Point3
weight : Double
mode : LayerBlendMode
priority : Int
} derive(Debug)pub struct Point3ConstraintResult {
value : Point3
velocity : Point3
acceleration : Point3
status : ConstraintStatus2
error : Double
} derive(Debug)fn Point3Track::sample_many(self : Point3Track, count : Int, mode? : Extrapolation) -> Array[Point3] raise MotionErrorpub struct ProceduralMotion2 {
base : Point2
velocity : Point2
jitter : JitterSequence2
envelope : Curve
} derive(Debug)fn ProceduralMotion2::sample(self : ProceduralMotion2, time : Double, normalized_time : Double) -> Point2fn ProceduralMotion2::sample_many(self : ProceduralMotion2, start : Double, end : Double, count : Int) -> Array[Point2]pub struct QualityBudget2 {
temporal_limit : Double
spatial_limit : Double
color_limit : Double
minimum_coverage : Double
} derive(Debug)pub struct RenderFrame2 {
time : Double
passes : Array[RenderPass2]
clear_color : Rgba
visible_count : Int
} derive(Debug)pub struct RenderLayer2 {
id : Int
name : String
kind : RenderLayerKind2
order : Int
visible : Bool
opacity : Double
blend : BlendMode
bounds : Bounds2D
} derive(Debug)pub enum RenderLayerKind2 {
BackgroundLayer
GeometryLayer
SpriteLayer
TextLayer
ParticleLayer
EffectLayer
} derive(Debug)pub struct RenderPlan2 {
layers : Array[RenderLayer2]
start : Double
end : Double
clear_color : Rgba
} derive(Debug)pub struct RenderPlanStats2 {
layer_count : Int
visible_count : Int
total_area : Double
start : Double
end : Double
} derive(Debug)pub struct RenderQualityMetrics2 {
temporal_error : Double
spatial_error : Double
color_error : Double
dropped_frames : Int
coverage : Double
} derive(Debug)fn RenderQualityMetrics2::passed(self : RenderQualityMetrics2, temporal_limit : Double, spatial_limit : Double, color_limit : Double) -> Boolpub struct RetimeMap {
segments : Array[RetimeSegment]
input_start : Double
input_end : Double
output_start : Double
output_end : Double
} derive(Debug)fn RetimeMapBuilder::add(self : RetimeMapBuilder, segment : RetimeSegment) -> RetimeMapBuilder raise MotionErrorfn RgbaTrack::new(frames : Array[RgbaKeyframe], premultiplied? : Bool) -> RgbaTrack raise MotionErrorfn RgbaTrack::sample_many(self : RgbaTrack, count : Int, mode? : Extrapolation) -> Array[Rgba] raise MotionErrorpub struct SampleCacheKey2 {
track_id : Int
revision : Int
samples : Int
start : Double
end : Double
} derive(Debug)pub struct SampleValidationPolicy2 {
tolerance : Double
endpoint_tolerance : Double
maximum_gap : Double
require_monotonic_time : Bool
} derive(Debug)fn SampleValidationPolicy2::with_gap(self : SampleValidationPolicy2, value : Double) -> SampleValidationPolicy2fn SampleValidationPolicy2::with_monotonic_time(self : SampleValidationPolicy2, value : Bool) -> SampleValidationPolicy2fn SampleValidationPolicy2::with_tolerance(self : SampleValidationPolicy2, value : Double) -> SampleValidationPolicy2pub struct SamplingConfig {
start : Double
end : Double
frame_rate : Double
include_end : Bool
} derive(Debug)fn SamplingConfig::new(start : Double, end : Double, frame_rate : Double, include_end? : Bool) -> SamplingConfig raise MotionErrorpub struct ScalarBlendLayer {
value : Double
weight : Double
mode : LayerBlendMode
priority : Int
} derive(Debug)pub struct ScalarChannel {
name : String
track : ScalarTrack
enabled : Bool
weight : Double
offset : Double
} derive(Debug)fn ScalarChannel::with_offset(self : ScalarChannel, offset : Double) -> ScalarChannel raise MotionErrorfn ScalarChannel::with_weight(self : ScalarChannel, weight : Double) -> ScalarChannel raise MotionErrorpub struct ScalarSampleCache2 {
key : SampleCacheKey2
times : Array[Double]
values : Array[Double]
} derive(Debug)fn ScalarTrack::map_values(self : ScalarTrack, mapper : (Double) -> Double) -> ScalarTrack raise MotionErrorfn ScalarTrack::sample_motion(self : ScalarTrack, time : Double, mode? : Extrapolation) -> MotionSamplefn ScalarTrack::sample_values(self : ScalarTrack, times : Array[Double], mode? : Extrapolation) -> Array[Double]fn ScalarTrack::trim(self : ScalarTrack, start : Double, end : Double) -> ScalarTrack raise MotionErrorpub struct ScalarTrackBundle {
channels : Array[ScalarChannel]
start_time : Double
end_time : Double
} derive(Debug)fn ScalarTrackBundle::sample(self : ScalarTrackBundle, time : Double, mode? : Extrapolation) -> BundleSamplefn ScalarTrackBundle::sample_many(self : ScalarTrackBundle, count : Int, mode? : Extrapolation) -> Array[BundleSample] raise MotionErrorfn ScalarTrackBundle::set_enabled(self : ScalarTrackBundle, name : String, enabled : Bool) -> ScalarTrackBundle raise MotionErrorfn ScalarTrackBundle::set_weight(self : ScalarTrackBundle, name : String, weight : Double) -> ScalarTrackBundle raise MotionErrorfn ScalarTrackBundle::with_channel(self : ScalarTrackBundle, channel : ScalarChannel) -> ScalarTrackBundle raise MotionErrorfn ScalarTrackBundle::without(self : ScalarTrackBundle, name : String) -> ScalarTrackBundle raise MotionErrorfn ScalarTrackBundleBuilder::add(self : ScalarTrackBundleBuilder, channel : ScalarChannel) -> ScalarTrackBundleBuilder raise MotionErrorfn ScalarTrackBundleBuilder::build(self : ScalarTrackBundleBuilder) -> ScalarTrackBundle raise MotionErrorpub(all) struct SequenceSample {
time : Double
value : Double
index : Int
progress : Double
state : SequenceState
} derive(Debug)pub enum ShakeFalloff2 {
ConstantShake
LinearShake
SmoothShake
ExponentialShake(Double)
} derive(Debug)pub struct SoftRange2 {
minimum : Double
maximum : Double
softness : Double
restitution : Double
} derive(Debug)fn SoftRange2::resolve(self : SoftRange2, value : Double, velocity : Double) -> (Double, Double, ConstraintStatus2)fn Spline2D::new(points : Array[Point2], tension? : Double, closed? : Bool) -> Spline2D raise MotionErrorfn Spline2D::project(self : Spline2D, target : Point2, samples_per_segment? : Int) -> SplineProjectionfn Spline3D::new(points : Array[Point3], tension? : Double, closed? : Bool) -> Spline3D raise MotionErrorpub struct SpringSpec {
stiffness : Double
damping : Double
mass : Double
initial_velocity : Double
} derive(Debug)fn SpringSpec::is_settled(self : SpringSpec, start : Double, end : Double, time : Double, tolerance? : Double) -> Boolfn SpringSpec::sample(self : SpringSpec, start : Double, end : Double, time : Double) -> MotionSamplefn SpringSpec::sample_many(self : SpringSpec, start : Double, end : Double, duration : Double, count : Int) -> Array[MotionSample] raise MotionErrorfn SpringSpec::velocity_at(self : SpringSpec, start : Double, end : Double, time : Double) -> Doublefn TimeWarp::new(curve : Curve, start : Double, end : Double, speed? : Double) -> TimeWarp raise MotionErrorpub struct Timecode2 {
hours : Int
minutes : Int
seconds : Int
frames : Int
frame_rate : Double
} derive(Debug)fn Timeline::sample_window(self : Timeline, config : SamplingConfig, mode? : Extrapolation) -> Array[Array[TimelineValue]]pub enum TimelineEdgeKind {
StartAfterEnd
StartAfterStart
EndWithEnd
OffsetLink(Double)
} derive(Debug)pub struct TimelineEvaluation2 {
context : EvaluationContext2
active_nodes : Array[TimelineGraphNode]
render_frame : RenderFrame2
events : Array[MotionEvent2]
} derive(Debug)pub struct TimelineEvaluator2 {
graph : TimelineGraph
render_plan : RenderPlan2
event_queue : MotionEventQueue2
previous_time : Double
} derive(Debug)fn TimelineEvaluator2::evaluate(self : TimelineEvaluator2, time : Double, frame : Int) -> TimelineEvaluation2fn TimelineEvaluator2::evaluate_schedule(self : TimelineEvaluator2, schedule : FrameSchedule2) -> Array[TimelineEvaluation2]pub struct TimelineGraph {
nodes : Array[TimelineGraphNode]
edges : Array[TimelineGraphEdge]
} derive(Debug)pub struct TimelineGraphNode {
id : Int
name : String
start : Double
duration : Double
enabled : Bool
} derive(Debug)pub struct TrackSlot {
name : String
track : ScalarTrack
offset : Double
enabled : Bool
} derive(Debug)pub struct Transform3Delta {
translation : Point3
rotation : Quaternion
scale : Point3
} derive(Debug)fn Transform3Track::map_values(self : Transform3Track, mapper : (Transform3D) -> Transform3D) -> Transform3Track raise MotionErrorfn Transform3Track::sample(self : Transform3Track, time : Double, mode? : Extrapolation) -> Transform3Dfn Transform3Track::sample_many(self : Transform3Track, count : Int, mode? : Extrapolation) -> Array[Transform3D] raise MotionErrorfn Transform3Track::scale_time(self : Transform3Track, factor : Double) -> Transform3Track raise MotionErrorfn Transform3Track::shift(self : Transform3Track, offset : Double) -> Transform3Track raise MotionErrorpub struct TransformTrack {
frames : Array[TransformKeyframe]
shortest_rotation : Bool
} derive(Debug)fn TransformTrack::new(frames : Array[TransformKeyframe], shortest_rotation? : Bool) -> TransformTrack raise MotionErrorfn TransformTrack::sample(self : TransformTrack, time : Double, mode? : Extrapolation) -> Transform2Dfn TransformTrack::sample_many(self : TransformTrack, count : Int, mode? : Extrapolation) -> Array[Transform2D] raise MotionErrorpub struct Tween {
from : Double
to : Double
duration : Double
delay : Double
repeat_count : Int
mode : Extrapolation
curve : Curve
} derive(Debug)fn Tween::new(from : Double, to : Double, duration : Double, delay? : Double, repeat_count? : Int, mode? : Extrapolation, curve? : Curve) -> Tween raise MotionErrorpub(all) struct TweenSample {
time : Double
value : Double
progress : Double
cycle : Int
state : TweenState
} derive(Debug)fn TweenSequence::sample_many(self : TweenSequence, count : Int) -> Array[SequenceSample] raise MotionErrorpub struct ValidationBundle2 {
reports : Array[DiagnosticReport2]
summary : DiagnosticSummary2
} derive(Debug)pub struct VectorField2 {
mode : VectorFieldMode2
scale : Double
falloff : Double
bounds : Bounds2D?
} derive(Debug)fn VectorField2::integrate(self : VectorField2, particle : FieldParticle2, start : Double, end : Double, steps : Int, drag : Double) -> Array[Point2]fn VectorField2::step(self : VectorField2, particle : FieldParticle2, time : Double, dt : Double, drag : Double) -> FieldParticle2pub enum VectorFieldMode2 {
UniformField(Point2)
RadialField(Point2, Double)
VortexField(Point2, Double)
NoiseField(NoiseSource2, Double)
} derive(Debug)fn adaptive_sample(func : (Double) -> Double, start : Double, end : Double, config : AdaptiveSamplingConfig) -> AdaptiveSampleResult raise MotionErrorfn adaptive_sample_tween(tween : Tween, start : Double, end : Double, config : AdaptiveSamplingConfig) -> AdaptiveSampleResult raise MotionErrorfn advect_points2(field : VectorField2, points : Array[Point2], time : Double, dt : Double) -> Array[Point2]fn analyze_point_series2(series : PointSeries2, target : Point2, tolerance : Double) -> MotionMetrics2fn apply_transform3_delta(value : Transform3D, delta : Transform3Delta, weight : Double) -> Transform3Dfn back_in(t : Double, overshoot? : Double) -> Doublefn blend(first : (Double) -> Double, second : (Double) -> Double, amount~ : Double) -> ((Double) -> Double)fn blend_bundles(first : ScalarTrackBundle, second : ScalarTrackBundle, amount : Double) -> ScalarTrackBundle raise MotionErrorfn blend_transform3_layers(layers : Array[Transform3BlendLayer], fallback : Transform3D) -> Transform3Dfn bounce_out(t : Double) -> Doublefn build_event_window(queue : MotionEventQueue2, previous : Double, current : Double) -> EventWindow2fn camera_framing2(center : Point3, radius : Double, policy : FramingPolicy2, margin? : Double) -> CameraFraming2fn camera_keyframe(time : Double, pose : CameraPose, lens : CameraLens, curve? : Curve) -> CameraKeyframe raise MotionErrorfn catmull_rom(previous : Double, start : Double, end : Double, next : Double, t : Double, tension? : Double) -> Doublefn cleanup_samples(values : Array[Double], tolerance : Double) -> (Array[Double], KeyframeCleanupReport)fn color_blend_layer(value : Rgba, weight : Double, mode? : BlendMode, priority? : Int) -> ColorBlendLayerfn compose(outer : (Double) -> Double, inner : (Double) -> Double) -> ((Double) -> Double)fn compose_retime(first : RetimeMap, second : RetimeMap, samples_per_segment? : Int) -> RetimeMap raise MotionErrorfn constrain_point2_step(target : Point2, current : Point2, velocity : Point2, acceleration : Point2, dt : Double, limit : MotionLimitProfile2) -> Point2ConstraintResultfn constrain_point3_step(target : Point3, current : Point3, velocity : Point3, acceleration : Point3, dt : Double, limit : MotionLimitProfile2) -> Point3ConstraintResultfn constrain_scalar_step(target : Double, current : Double, velocity : Double, acceleration : Double, dt : Double, limit : MotionLimitProfile2) -> ConstraintResult2fn constraint_solve_config(frame_rate : Double, limits : MotionLimitProfile2) -> ConstraintSolveConfigfn critically_damped_step(current : Double, target : Double, velocity : Double, response : Double, delta_time : Double) -> (Double, Double)fn cubic_path2d(start : Point2, control_start : Point2, control_end : Point2, end : Point2) -> CubicPath2Dfn cubic_path3d(start : Point3, control_start : Point3, control_end : Point3, end : Point3) -> CubicPath3Dfn curve_lookup(func : (Double) -> Double, start : Double, end : Double, count : Int) -> Array[SamplePoint] raise MotionErrorfn curve_pipeline_error(pipeline : CurvePipeline2, table : CurveLookupTable, samples : Int) -> Doublefn curve_remap2(input_min : Double, input_max : Double, output_min : Double, output_max : Double) -> CurveRemap2fn damp_to_range(value : Double, minimum : Double, maximum : Double, strength : Double) -> Doublefn derivative_of(func : (Double) -> Double, t : Double, step? : Double) -> Doublefn elastic_in(t : Double, amplitude? : Double, period? : Double) -> Doublefn estimate_compressed_bytes(frame_count : Int, width : Int, height : Int, bits_per_pixel : Double, compression : Double) -> Intfn evaluation_context2(time : Double, frame : Int, normalized : Double, delta : Double, direction : Int) -> EvaluationContext2fn export_duration_for_frames(frame_count : Int, frame_rate : Double) -> Doublefn export_manifest_entry2(id : Int, name : String, start : Double, end : Double, frame_count : Int) -> ExportManifestEntry2fn export_settings2(format : ExportFormat2, width : Int, height : Int, frame_rate : Double) -> ExportSettings2fn field_divergence2(field : VectorField2, position : Point2, time : Double, epsilon? : Double) -> Doublefn filter_events_by_kind(events : Array[MotionEvent2], kind : MotionEventKind2) -> Array[MotionEvent2]fn find_signal_peaks2(values : Array[Double], threshold : Double, minimum_distance : Int) -> Array[SignalPeak2]fn frame_budget2(schedule : FrameSchedule2, bytes_per_frame : Int, throughput : Double) -> FrameBudget2fn frame_schedule2(start : Double, end : Double, frame_rate : Double, first_frame? : Int) -> FrameSchedule2fn hermite(start : Double, end : Double, tangent_start : Double, tangent_end : Double, t : Double) -> Doublefn inspect_motion_limits(name : String, samples : Array[Double], frame_rate : Double, maximum_velocity : Double) -> DiagnosticReport2fn inspect_scalar_values(name : String, values : Array[Double], tolerance : Double) -> DiagnosticReport2fn integrate_curve(func : (Double) -> Double, samples : Int) -> Doublefn interpolate_angle(start : Double, end : Double, t : Double) -> Doublefn interpolate_scalar(start : Double, end : Double, t : Double) -> Doublefn interpolate_transform(start : Transform2D, end : Transform2D, t : Double, shortest_rotation? : Bool) -> Transform2Dfn local_maxima(samples : Array[SamplePoint], prominence : Double) -> Array[SamplePoint] raise MotionErrorfn map_curve_range(samples : Array[SamplePoint], output_min : Double, output_max : Double) -> Array[SamplePoint]fn marker_sequence(names : Array[String], start : Double, interval : Double) -> MarkerTimeline raise MotionErrorfn media_asset2(id : Int, name : String, kind : MediaKind2, start : Double, duration : Double, bounds : Bounds2D) -> MediaAsset2fn metric_within_budget2(metrics : MotionMetrics2, maximum_speed : Double, maximum_acceleration : Double) -> Boolfn mirror(ease : (Double) -> Double) -> ((Double) -> Double)fn motion_budget2(maximum_speed : Double, maximum_acceleration : Double, maximum_path_length : Double) -> MotionBudget2fn motion_clip(name : String, track : ScalarTrack, markers? : MarkerTimeline, loop_mode? : ClipLoopMode) -> MotionClip raise MotionErrorfn motion_event2(time : Double, id : Int, label : String, kind : MotionEventKind2, payload? : Double) -> MotionEvent2fn motion_limit_profile2(maximum_velocity? : Double, maximum_acceleration? : Double, maximum_jerk? : Double, tolerance? : Double, iterations? : Int) -> MotionLimitProfile2fn motion_profile(func : (Double) -> Double, samples : Int) -> Array[MotionSample] raise MotionErrorfn motion_report2(name : String, metrics : Array[Double], budget : MotionBudget2, quality : RenderQualityMetrics2) -> MotionReport2fn motion_transition(from : String, to : String, duration : Double, curve? : Curve) -> MotionStateTransition raise MotionErrorfn path_cubic(start : Point2, control_start : Point2, control_end : Point2, end : Point2) -> PathSegment2Dfn path_cubic3d(start : Point3, control_start : Point3, control_end : Point3, end : Point3) -> PathSegment3Dfn perspective_lens(field_of_view : Double, near_plane? : Double, far_plane? : Double) -> CameraLensfn point2_blend_layer(value : Point2, weight : Double, mode? : LayerBlendMode, priority? : Int) -> Point2BlendLayerfn point2_keyframe(time : Double, value~ : Point2, curve? : Curve) -> Point2Keyframe raise MotionErrorfn point3_blend_layer(value : Point3, weight : Double, mode? : LayerBlendMode, priority? : Int) -> Point3BlendLayerfn point3_keyframe(time : Double, value~ : Point3, curve? : Curve) -> Point3Keyframe raise MotionErrorfn polynomial_in(t : Double, exponent~ : Double) -> Doublefn procedural_motion2(base : Point2, velocity : Point2, jitter : JitterSequence2, envelope : Curve) -> ProceduralMotion2fn project_to_range(value : Double, minimum : Double, maximum : Double) -> Doublefn quad_in_out(t : Double) -> Doublefn quality_budget2(temporal_limit : Double, spatial_limit : Double, color_limit : Double, minimum_coverage : Double) -> QualityBudget2fn quart_in_out(t : Double) -> Doublefn quint_in_out(t : Double) -> Doublefn remap_value(value : Double, source_min : Double, source_max : Double, target_min : Double, target_max : Double) -> Doublefn render_layer2(id : Int, name : String, kind : RenderLayerKind2, order : Int, bounds : Bounds2D) -> RenderLayer2fn resample_adaptive(result : AdaptiveSampleResult, count : Int) -> Array[SamplePoint] raise MotionErrorfn retime_linear(input_start : Double, input_end : Double, output_start : Double, output_end : Double) -> RetimeMap raise MotionErrorfn retime_segment(input_start : Double, input_end : Double, output_start : Double, output_end : Double, curve? : Curve) -> RetimeSegment raise MotionErrorfn sample_cache_key2(track_id : Int, revision : Int, samples : Int, start : Double, end : Double) -> SampleCacheKey2fn sample_function(func : (Double) -> Double, start : Double, end : Double, count : Int) -> Array[SamplePoint] raise MotionErrorfn sample_track(track : ScalarTrack, config : SamplingConfig, mode? : Extrapolation) -> Array[SamplePoint]fn scalar_blend_layer(value : Double, weight : Double, mode? : LayerBlendMode, priority? : Int) -> ScalarBlendLayerfn scalar_channel(name : String, track : ScalarTrack, enabled? : Bool, weight? : Double, offset? : Double) -> ScalarChannel raise MotionErrorfn sequence_item(clip : MotionClip, start : Double, weight? : Double) -> ClipSequenceItem raise MotionErrorfn simplify_samples(samples : Array[SamplePoint], tolerance : Double) -> Array[SamplePoint] raise MotionErrorfn smooth_damp(current : Double, target : Double, velocity : Double, smooth_time : Double, delta_time : Double) -> (Double, Double)fn soft_limit(value : Double, minimum : Double, maximum : Double, softness : Double) -> Doublefn soft_range2(minimum : Double, maximum : Double, softness? : Double, restitution? : Double) -> SoftRange2fn solve_constrained_points2(values : Array[Point2], config : ConstraintSolveConfig) -> Array[Point2]fn solve_constrained_points3(values : Array[Point3], config : ConstraintSolveConfig) -> Array[Point3]fn solve_constrained_signal(values : Array[Double], config : ConstraintSolveConfig) -> ConstraintSolveResultfn split_export_chunks(schedule : FrameSchedule2, chunk_size : Int, bytes_per_frame : Int) -> Array[ExportChunk2]fn spring_spec(stiffness : Double, damping : Double, mass? : Double, initial_velocity? : Double) -> SpringSpec raise MotionErrorfn threshold_crossings(samples : Array[SamplePoint], threshold : Double) -> Array[Double] raise MotionErrorfn timeline_graph_node(id : Int, name : String, start : Double, duration : Double) -> TimelineGraphNodefn transform2d(position~ : Point2, scale~ : Point2, rotation~ : Double, skew? : Double) -> Transform2Dfn transform3_blend_layer(value : Transform3D, weight : Double, priority? : Int) -> Transform3BlendLayerfn transform3_keyframe(time : Double, value~ : Transform3D, curve? : Curve) -> Transform3Keyframe raise MotionErrorfn transform_keyframe(time : Double, value~ : Transform2D, curve? : Curve) -> TransformKeyframe raise MotionErrorfn transport_frames(range : TransportRange, frame_rate : Double, markers? : MarkerTimeline) -> Array[TransportFrame] raise MotionErrorfn validate_export_dimensions(width : Int, height : Int, maximum : Int) -> Boolfn validate_lut2(name : String, table : CurveLookupTable, curve : Curve, policy : SampleValidationPolicy2) -> DiagnosticReport2fn validate_sample_times2(name : String, times : Array[Double], policy : SampleValidationPolicy2) -> DiagnosticReport2fn validate_sample_values2(name : String, values : Array[Double], policy : SampleValidationPolicy2) -> DiagnosticReport2Install
Download zipA dependency-free MoonBit motion toolkit for media timelines, easing curves, cubic Bezier inversion, and scalar keyframes.