Struct Keyframe
Defined in File keyframe.hpp
Struct Documentation
-
struct Keyframe
A single control point on an animation curve.
A keyframe is a value at a point in time together with the data needed to interpolate towards its neighbours: the interpolation Function, the HandleMode, and the two Bézier handles. The handles are only used when the function is Function::Bezier.
Keyframes are value types: they can be constructed, copied and compared freely. To place a keyframe in a channel (which keeps them time-sorted and applies handle constraints) use Channel::create_keyframe.
Public Functions
-
inline Keyframe(const Point &position, Function function = Function::Bezier, HandleMode handle_mode = HandleMode::Smooth, const Point &in_handle = Point(), const Point &out_handle = Point())
Constructs a keyframe from a position point.
- Parameters:
position – The (time, value) position.
function – Interpolation function (default Function::Bezier).
handle_mode – Handle mode (default HandleMode::Smooth).
in_handle – Incoming handle (defaults to the origin).
out_handle – Outgoing handle (defaults to the origin).
-
inline Keyframe(double time, double value, Function function = Function::Bezier, HandleMode handle_mode = HandleMode::Smooth, const Point &in_handle = Point(), const Point &out_handle = Point())
Constructs a keyframe from a time and value.
- Parameters:
time – Time component of the position.
value – Value component of the position.
function – Interpolation function (default Function::Bezier).
handle_mode – Handle mode (default HandleMode::Smooth).
in_handle – Incoming handle (defaults to the origin).
out_handle – Outgoing handle (defaults to the origin).
-
inline Keyframe()
Constructs a default keyframe at the origin (Bézier / Smooth).
-
inline bool operator==(const Keyframe &other) const
Equality across position, both handles, function and handle mode.
-
inline double time() const
Convenience accessor for the position’s time component.
-
inline double value() const
Convenience accessor for the position’s value component.
Public Members
-
HandleMode handle_mode
How the handles are computed and constrained.
-
inline Keyframe(const Point &position, Function function = Function::Bezier, HandleMode handle_mode = HandleMode::Smooth, const Point &in_handle = Point(), const Point &out_handle = Point())