Class Property.Animator

java.lang.Object
org.praxislive.code.userapi.Property.Animator
Enclosing class:
Property

public static class Property.Animator extends Object
Provides keyframe animation support for Property. Methods return this so that they can be chained - eg. to(1, 0).in(1, 0.25).easeInOut()
  • Method Details

    • to

      public Property.Animator to(double... to)
      Set the target values for animation and start animation. The number of values provided to this method controls the number of keyframes.
      Parameters:
      to - target values
      Returns:
      this
    • in

      public Property.Animator in(double... in)
      Set the time in seconds for each keyframe. The number of provided values may be different than the number of keyframes passed to to(). Values will be cycled through as needed.

      eg. to(100, 50, 250).in(1, 0.5) is the same as to(100, 50, 250).in(1, 0.5, 1)

      Parameters:
      in - times in seconds
      Returns:
      this
    • easing

      public Property.Animator easing(Easing... easing)
      Set the easing mode for each keyframe. The number of provided values may be different than the number of keyframes passed to to(). Values will be cycled through as needed.
      Parameters:
      easing - easing mode to use
      Returns:
      this
    • linear

      public Property.Animator linear()
      Convenience method to use Easing.linear easing for all keyframes.
      Returns:
      this
    • ease

      public Property.Animator ease()
      Convenience method to use Easing.ease easing for all keyframes.
      Returns:
      this
    • easeIn

      public Property.Animator easeIn()
      Convenience method to use Easing.easeIn easing for all keyframes.
      Returns:
      this
    • easeOut

      public Property.Animator easeOut()
      Convenience method to use Easing.easeOut easing for all keyframes.
      Returns:
      this
    • easeInOut

      public Property.Animator easeInOut()
      Convenience method to use Easing.easeInOut easing for all keyframes.
      Returns:
      this
    • stop

      public Property.Animator stop()
      Stop animating. The current property value will be retained.
      Returns:
      this
    • isAnimating

      public boolean isAnimating()
      Whether an animation is currently active.
      Returns:
      animation active
    • whenDone

      public Property.Animator whenDone(Consumer<Property> whenDoneConsumer)
      Set a consumer to be called each time the Animator finishes animation. Also calls the consumer immediately if no animation is currently active.

      Unlike restarting an animation by polling isAnimating(), an animation started inside this consumer will take into account any time overrun between the target and actual finish time of the completing animation.

      Parameters:
      whenDoneConsumer - function to call
      Returns:
      this