GCubeSDK
©2026 FenixFox®Studios

KeyframeTrack

Represents a sequence of keyframes for animating object properties.
This class manages keyframe data for animation tracks, providing methods to manipulate keyframes and interpolate values with Interpolant classes i.e. CubicInterpolant, DiscreteInterpolant and LinearInterpolant. Each track holds a specific property of an object over time. Key Features:

  • Add keyframes with time/value pairs
  • Multiple interpolation modes
  • Keyframe manipulation (shift, scale, trim)
  • Validation and error checking
  • Use with AnimationMixer for playback

Methods

KeyframeTrack(const string& name, const vector<f32>& times, const vector<f32>& values, InterpolationModes interpolation = InterpolationModes::InterpolateLinear)

Constructor with keyframe data and interpolation mode

name Track name identifier
times Array of keyframe times
values Array of keyframe values
interpolation Interpolation mode InterpolateLinear

KeyframeTrack clone() const

Returns a copy of this track

InterpolationModes getInterpolation() const

Returns the interpolation type

u32 getValueSize() const

Returns the size of each value

KeyframeTrack& optimize()

Optimizes this keyframe track by removing equivalent sequential keys

KeyframeTrack& scale(f32 timeScale)

Scales all keyframe times by a factor

timeScale Scale factor to apply to all keyframe times

KeyframeTrack& setInterpolation(InterpolationModes interpolationType)

Sets the interpolation type

interpolationType New interpolation type

KeyframeTrack& shift(f32 timeOffsetInSeconds)

Moves all keyframes either forward or backward in time

timeOffsetInSeconds Time offset to apply to all keyframes

KeyframeTrack& trim(f32 startTimeInSeconds, f32 endTimeInSeconds)

Removes keyframes before startTime and after endTime

startTimeInSeconds Start time for trimming
endTimeInSeconds End time for trimming

bool validate() const

Performs minimal validation on the tracks

f32 getValueAtTime(f32 time) const

Gets interpolated value at specific time using proper Interpolant class

time Time to get value for

Properties

interpolation InterpolationModes Interpolation mode
name string Track name identifier
times vector Array of keyframe times
values vector Array of keyframe values