Record Class ValueTrack

java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcanvas.api.cutscene.ValueTrack

public record ValueTrack(List<ValueTrack.Key> keys) extends Record
A number that changes over a cutscene, as keys in time: how far the letterbox bars are in, how dark the fade is. Before the first key it holds the first value, after the last the last.
ValueTrack.of(0, 0.0F, 15, 1.0F)                                  // 0 at the start, 1 from tick 15 on
ValueTrack.constant(1.0F)
ValueTrack.EMPTY.then(0, 1.0F).then(20, 0.0F, Easing.SINE_OUT)    // from 1 down to 0, easing out
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<ValueTrack>
     
    static final ValueTrack
    No keys: 0 throughout.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a ValueTrack record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    at(float time)
    The value at a time, in ticks.
    static ValueTrack
    constant(float value)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
     
    Returns the value of the keys record component.
    static ValueTrack
    of(float... timesAndValues)
    Keys from pairs of a time and a value, eased gently between.
    then(float time, float value)
    This track with one more key, eased gently.
    then(float time, float value, Easing easing)
     
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • EMPTY

      public static final ValueTrack EMPTY
      No keys: 0 throughout.
    • CODEC

      public static final com.mojang.serialization.Codec<ValueTrack> CODEC
  • Constructor Details

    • ValueTrack

      public ValueTrack(List<ValueTrack.Key> keys)
      Creates an instance of a ValueTrack record class.
      Parameters:
      keys - the value for the keys record component
  • Method Details

    • constant

      public static ValueTrack constant(float value)
    • of

      public static ValueTrack of(float... timesAndValues)
      Keys from pairs of a time and a value, eased gently between.
    • then

      public ValueTrack then(float time, float value)
      This track with one more key, eased gently.
    • then

      public ValueTrack then(float time, float value, Easing easing)
    • isEmpty

      public boolean isEmpty()
    • at

      public float at(float time)
      The value at a time, in ticks.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • keys

      public List<ValueTrack.Key> keys()
      Returns the value of the keys record component.
      Returns:
      the value of the keys record component