Interface TransitionRule

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface TransitionRule
Picks the transition between two animations on a layer, asked each time one gives way to another (unless the new motion names its own). Return null to fall through to the layer's pair rules and default.
layer.transitions((from, to, ctx) -> {
    if (to.clip().equals("hurt")) return Transition.CUT;                                 // flinches snap
    if ("run".equals(from)) return Transition.freeze(0.35F, Easing.CUBIC_OUT);          // skid to a stop
    return ctx.inWater() ? Transition.crossfade(0.5F) : null;                           // slow blends underwater
});
  • Method Details

    • choose

      @Nullable @Nullable Transition choose(@Nullable @Nullable String from, Motion to, ArmatureContext context)
      Parameters:
      from - the clip playing now, or null when nothing is
      to - the motion about to play