Record Class VectorPoint

java.lang.Object
java.lang.Record
kr.toxicity.model.api.animation.VectorPoint
Record Components:
function - a function to get the vector value, which may be dynamic (e.g., based on Molang expressions)
time - the time of this keyframe in seconds
bezier - the bezier curve configuration for interpolation, if applicable
interpolator - the interpolation method to use (e.g., linear, bezier, catmull-rom)
All Implemented Interfaces:
Comparable<Timed>, Timed

public record VectorPoint(@NotNull FloatFunction<org.joml.Vector3f> function, float time, @NotNull VectorPoint.BezierConfig bezier, @NotNull VectorInterpolator interpolator) extends Record implements Timed
Represents a keyframe point in an animation timeline.

This record holds the value of a vector (position, rotation, or scale) at a specific time, along with interpolation information to create smooth transitions between keyframes.

Since:
1.15.2
  • Field Details

    • EMPTY

      public static final VectorPoint EMPTY
      An empty, default vector point at time 0 with linear interpolation.
      Since:
      1.15.2
  • Constructor Details

    • VectorPoint

      public VectorPoint(@NotNull @NotNull FloatFunction<org.joml.Vector3f> function, float time, @NotNull @NotNull VectorPoint.BezierConfig bezier, @NotNull @NotNull VectorInterpolator interpolator)
      Creates an instance of a VectorPoint record class.
      Parameters:
      function - the value for the function record component
      time - the value for the time record component
      bezier - the value for the bezier record component
      interpolator - the value for the interpolator record component
  • Method Details

    • vector

      @NotNull public @NotNull org.joml.Vector3f vector()
      Gets the vector value at this keyframe's specific time.
      Returns:
      the vector value
      Since:
      1.15.2
    • vector

      @NotNull public @NotNull org.joml.Vector3f vector(float time)
      Gets the vector value at a specific time, evaluating the function if necessary.
      Parameters:
      time - the time to evaluate at
      Returns:
      the calculated vector
      Since:
      1.15.2
    • isContinuous

      public boolean isContinuous()
      Checks if the interpolation method for this point is continuous.
      Returns:
      true if continuous (e.g., linear), false if stepped
      Since:
      1.15.2
    • equals

      public 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 the compare method from their corresponding wrapper classes.
      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.
    • hashCode

      public 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
    • 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
    • function

      @NotNull public @NotNull FloatFunction<org.joml.Vector3f> function()
      Returns the value of the function record component.
      Returns:
      the value of the function 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
    • bezier

      @NotNull public @NotNull VectorPoint.BezierConfig bezier()
      Returns the value of the bezier record component.
      Returns:
      the value of the bezier record component
    • interpolator

      @NotNull public @NotNull VectorInterpolator interpolator()
      Returns the value of the interpolator record component.
      Returns:
      the value of the interpolator record component