Interface Animation

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 Animation
An animation is a function which is called repeatedly during its lifetime, which is determined by a LifeTime and a RunCondition.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    This method is called after the animation has finished.
    static <T> Animation
    of(sprouts.Var<T> target, AnimationTransformation<T> animator)
    Creates an Animation that animates the item of the supplied Var property in a transformative way, instead of producing side effects on the property item itself.
    void
    This method is called repeatedly during the lifetime of the animation.
  • Method Details

    • of

      static <T> Animation of(sprouts.Var<T> target, AnimationTransformation<T> animator)
      Creates an Animation that animates the item of the supplied Var property in a transformative way, instead of producing side effects on the property item itself.
      Parameters:
      target - The value that is animated.
      animator - A function taking in the current animation status and a value to be transformed and returned based in the status.
      Returns:
      The created Animation.
    • run

      void run(AnimationStatus status) throws Exception
      This method is called repeatedly during the lifetime of the animation. The AnimationStatus contains information about the current state of the animation.
      Note that this method deliberately requires the handling of checked exceptions at its invocation sites because there may be any number of implementations hiding behind this interface and so it is unwise to assume that all of them will be able to execute gracefully without throwing exceptions.
      Parameters:
      status - The current state of the animation.
      Throws:
      Exception - If during the execution of this method an error is raised. Due to this being a generic interface, the likelihood of exceptions being thrown is high and so it is recommended to handle them at the invocation site.
    • finish

      default void finish(AnimationStatus status) throws Exception
      This method is called after the animation has finished. The default implementation does nothing. Use this to clean up the state of your components any used resources after the animation has finished.
      Note that this method deliberately requires the handling of checked exceptions at its invocation sites because there may be any number of implementations hiding behind this interface and so it is unwise to assume that all of them will be able to execute gracefully without throwing exceptions.
      Parameters:
      status - The current state of the animation.
      Throws:
      Exception - If during the execution of this method an error is raised. Due to this being a generic interface, the likelihood of exceptions being thrown is high and so it is recommended to handle them at the invocation site.