Record Class ModelKeyframe

java.lang.Object
java.lang.Record
kr.toxicity.model.api.data.raw.ModelKeyframe
Record Components:
channel - the channel this keyframe affects (position, rotation, scale)
dataPoints - the list of data points (values) for this keyframe
bezierLeftTime - the time offset for the left bezier handle
bezierLeftValue - the value offset for the left bezier handle
bezierRightTime - the time offset for the right bezier handle
bezierRightValue - the value offset for the right bezier handle
interpolation - the interpolation type (e.g., linear, catmullrom, bezier)
time - the time of the keyframe in seconds
All Implemented Interfaces:
Comparable<Timed>, Timed

@Internal public record ModelKeyframe(@Nullable KeyframeChannel channel, @NotNull List<ModelDatapoint> dataPoints, @Nullable Float3 bezierLeftTime, @Nullable Float3 bezierLeftValue, @Nullable Float3 bezierRightTime, @Nullable Float3 bezierRightValue, @Nullable VectorInterpolator interpolation, float time) extends Record implements Timed
Represents a single keyframe in an animation timeline.

A keyframe defines the state of a bone (position, rotation, or scale) at a specific time, along with interpolation data (linear, catmull-rom, bezier) to smooth transitions.

Since:
1.15.2
  • Constructor Details

    • ModelKeyframe

      public ModelKeyframe(@Nullable @Nullable KeyframeChannel channel, @NotNull @NotNull List<ModelDatapoint> dataPoints, @Nullable @Nullable Float3 bezierLeftTime, @Nullable @Nullable Float3 bezierLeftValue, @Nullable @Nullable Float3 bezierRightTime, @Nullable @Nullable Float3 bezierRightValue, @Nullable @Nullable VectorInterpolator interpolation, float time)
      Creates an instance of a ModelKeyframe record class.
      Parameters:
      channel - the value for the channel record component
      dataPoints - the value for the dataPoints record component
      bezierLeftTime - the value for the bezierLeftTime record component
      bezierLeftValue - the value for the bezierLeftValue record component
      bezierRightTime - the value for the bezierRightTime record component
      bezierRightValue - the value for the bezierRightValue record component
      interpolation - the value for the interpolation record component
      time - the value for the time record component
  • Method Details

    • hasPoint

      public boolean hasPoint()
      Checks if this keyframe contains any data points.
      Returns:
      true if data points exist, false otherwise
      Since:
      1.15.2
    • point

      @NotNull public @NotNull ModelDatapoint point()
      Returns the first data point in the list.
      Returns:
      the first data point
      Throws:
      NoSuchElementException - if the list is empty
      Since:
      1.15.2
    • point

      @NotNull public @NotNull VectorPoint point(@NotNull @NotNull ModelLoadContext context, @NotNull @NotNull Function<org.joml.Vector3f,org.joml.Vector3f> function)
      Converts this keyframe into a processed VectorPoint.
      Parameters:
      context - the model loading context
      function - a transformation function to apply to the vector values (e.g., coordinate conversion)
      Returns:
      the vector point
      Since:
      1.15.2
    • interpolation

      @NotNull public @NotNull VectorInterpolator interpolation()
      Returns the interpolation type for this keyframe.
      Returns:
      the interpolation type, defaulting to VectorInterpolator.LINEAR if null
      Since:
      1.15.2
    • channel

      @NotNull public @NotNull KeyframeChannel channel()
      Returns the channel this keyframe affects.
      Returns:
      the channel, defaulting to KeyframeChannel.NOT_FOUND if null
      Since:
      1.15.2
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • dataPoints

      @SerializedName("data_points") @NotNull public @NotNull List<ModelDatapoint> dataPoints()
      Returns the value of the dataPoints record component.
      Returns:
      the value of the dataPoints record component
    • bezierLeftTime

      @SerializedName("bezier_left_time") @Nullable public @Nullable Float3 bezierLeftTime()
      Returns the value of the bezierLeftTime record component.
      Returns:
      the value of the bezierLeftTime record component
    • bezierLeftValue

      @SerializedName("bezier_left_value") @Nullable public @Nullable Float3 bezierLeftValue()
      Returns the value of the bezierLeftValue record component.
      Returns:
      the value of the bezierLeftValue record component
    • bezierRightTime

      @SerializedName("bezier_right_time") @Nullable public @Nullable Float3 bezierRightTime()
      Returns the value of the bezierRightTime record component.
      Returns:
      the value of the bezierRightTime record component
    • bezierRightValue

      @SerializedName("bezier_right_value") @Nullable public @Nullable Float3 bezierRightValue()
      Returns the value of the bezierRightValue record component.
      Returns:
      the value of the bezierRightValue record component
    • time

      public float time()
      Returns the value of the time record component.
      Specified by:
      time in interface Timed
      Returns:
      the value of the time record component