Class Easings

java.lang.Object
net.ixdarklord.coolcatcanvas.api.utils.Easings

public final class Easings extends Object
The Easing curves by name, for anything that is written down: cutscene files, commands, packets. The names are the constants' in lower case ("sine_in_out").
Easing easing = Easings.byName("cubic_out");      // null when there is no such curve
String name = Easings.nameOf(Easing.CUBIC_OUT);   // "cubic_out"
Easings.register("mymod:wobble", t -> ...);       // a mod's own curve, usable wherever names are read
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<Easing> CODEC
      Reads and writes a curve as its name; a curve that was never named can't be written.
  • Method Details

    • register

      public static void register(String name, Easing easing)
      Names a curve. Both sides of a connection need the same names for a curve to travel between them.
      Throws:
      IllegalArgumentException - if the name is taken by another curve
    • byName

      public static @Nullable Easing byName(String name)
    • nameOf

      public static @Nullable String nameOf(Easing easing)
      The name a curve was registered under, or null for one that never was (a lambda, or reversed()).
    • names

      public static List<String> names()
      Every name, in the order they were registered.