Skip to main content

Module curves

Module curves 

Source
Expand description

What an editor needs of a keyed number besides its value: control points to draw, speed, range, and edits that keep the curve it already shows.

Structs§

ControlSegment
One segment in (ticks, value): its two ends and, for a Bezier kind, its two control points.
CurveSample
A keyed number at one time.

Enums§

AutoTangent
How auto_tangents chooses the slope at a keyframe.
CurveError
Why a curve service did not do what was asked.
SegmentKind
What draws a segment.

Functions§

auto_tangents
Writes value-curve handles at the chosen keyframes (every keyframe when keys is None) from their neighbours. Each segment beside a chosen keyframe becomes an unweighted value curve (a cubic Hermite curve) that keeps the slope at its other end; held segments are left alone. A keyframe beside a held segment or at an end takes the slope of its one moving side.
contain
curve with each handle whose time coordinate lies outside 0..=1 shortened along its own direction until it lies on that edge: time and value are scaled alike, and a handle that points backwards in time collapses onto its keyframe. The result never runs backwards.
from_handle_points
The value curve whose four control points are given in (time, value), as Blender and Maya store weighted handles. Handles that reach past the other key give time coordinates outside what the engine takes; pass the result through contain.
from_slopes
The Hermite value curve of a segment seconds long that leaves at slope leave and arrives at slope arrive, both in value per second (glTF cubic spline tangents, unweighted tangents of Unity, Unreal and Maya).
from_speed_influence
The value curve of a segment seconds long whose ends have these (speed, influence) pairs, as After Effects shows them: speed in value per second, influence in percent of the segment’s length.
insert_eased_key
Adds a keyframe holding value at time to a value that has no value axis (a colour, a paint, a path), cutting the segment’s timing curve so both parts keep their shape. value is the caller’s sample of the animation at time.
insert_key
Adds a keyframe at time without changing the curve: the segment it falls in is cut by de Casteljau subdivision and the new keyframe takes the curve’s value there, rounded to f32. A steps segment becomes held keyframes, one where each value starts, and a points segment two tables, or straight lines between keyframes where a part ends level.
insert_point_key
Adds a keyframe at time to a position without changing its path or its speed along it: the timing curve is cut as by insert_eased_key and the spatial curve where that much of its arc length lies, measured in a space aspect wide per unit high.
materialize
Spells out as keyframes what the value’s before and after show over range, and sets each side the range reaches to hold: copies of the keyframes for every pass of a repeating mode that meets the range, and one keyframe at the range’s edge for linear.
path_to_keys
The position keyframes that show what the path position motion shows over range, with lengths measured in a space aspect wide per unit high: the same path at the same speed.
range
The least and greatest value of a number over range, overshoot between keyframes included, with its extrapolation.
sample
The value and velocity of a number at each of times, with its extrapolation. On a keyframe, at a wrap and at a turn of ping_pong the velocity is the one the curve arrives with. A value that is not keyed has no velocity.
segments
The segments of a keyed number, for drawing its curve and handles. Empty for a value that is not keyed.
to_timing_curves
Rewrites every value curve of a keyed number as the timing curve that draws the same line.
to_value_curves
Rewrites every timing curve and straight line of a keyed number as the value curve that draws the same line. Held, stepped and table segments stay.