Skip to content

Keyframes

Keyframe (abstract)

Base class for all keyframes. Handles position in the timeline editor and selection state.

Extend it and implement createMenu(), which returns the popup UI for editing this keyframe's properties.

Protected fields

FieldTypeDescription
x, yintPosition in the editor UI
tickintTemporal position
isSelectedbooleanSelection state
layerCutsceneLayerParent layer

Constants

ConstantValueDescription
SIZE7Visual size in the editor
KEYFRAME_SPRITEIdentifierDefault sprite
KEYFRAME_SELECTED_SPRITEIdentifierSelected sprite

KeyframeMenu<T extends Keyframe> (abstract)

Contextual popup UI for editing keyframe properties. Implement getContentHeight, renderContent, applyChanges, and initContent.

Constants

ConstantValue
WIDTH110
PADDING5
BUTTON_HEIGHT14
BUTTON_WIDTH50

KeyframeSegment<K extends Keyframe>

Record holding the two keyframes around a tick and the Catmull-Rom control points.

java
record KeyframeSegment<K extends Keyframe>(
    K from,      // start keyframe
    K to,        // end keyframe
    K p0,        // control point before `from`
    K p3,        // control point after `to`
    double rawT  // normalized t in [0, 1]
)

Produced by CutsceneLayer.findSegment(...).

EasingType

ValueInterpolation
LINEARLinear
EASE_INAccelerating
EASE_OUTDecelerating
SMOOTHEase in + out

Interpolation

Utility class for animating values between keyframes.

java
// Apply an easing curve to t in [0, 1]
double t2 = Interpolation.applyEasing(EasingType.SMOOTH, t);

// Standard lerp
double v = Interpolation.lerp(a, b, t);

// Angular lerp (handles 0 to 360 wrap)
double angle = Interpolation.lerpAngle(fromDeg, toDeg, t);

// Catmull-Rom (4 control points)
double v = Interpolation.catmullRom(p0, p1, p2, p3, t);