Interface Progress

All Known Implementing Classes:
AnimationState

public interface Progress
Represents the progress snapshot of an animation in terms of numbers between 0 and 1 that describe how far the animation has progressed between its start and end. The different methods of this interface provide various ways to interpret the progress of an animation, such as linearly, sinusoidally, or cyclically.
  • Method Summary

    Modifier and Type
    Method
    Description
    default double
    Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.
    default double
    cycleMinus(double offset)
    Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.
    default double
    cyclePlus(double offset)
    Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.
    default double
    The animation progress in the form of peaking sine wave growing from 0 to 1 based on the equation 0.5 * (1 + Math.sin( Math.PI * (progress() - 0.5) ) ) Just like the value returned by progress() the fadeIn() value starts at 0 and ends at 1, however the crucial difference is that the fadeIn() value grows according to a sine wave, which makes certain animations look more natural.
    default double
    fadeIn(double start, double end)
    The animation progress in the form of peaking sine wave growing from start to end based on the equation start + (end - start) * fadeIn().
    default double
    The animation progress in the form of peaking sine wave growing from 1 to 0 based on the equation 1 - fadeIn().
    default double
    fadeOut(double end, double start)
    The animation progress in the form of a sine wave going from start to end based on the equation end + (start - end) * fadeOut().
    default double
    The animation progress in the form of quickly growing sine wave front going from 0 to 1 based on the equation sin(PI * progress() / 2).
    default double
    jumpIn(double start, double end)
    The animation progress in the form of peaking sine wave growing from start to end based on the equation start + (end - start) * jumpIn().
    default double
    The animation progress in the form of peaking sine wave growing from 1 to 0 based on the equation sin(PI * (1 - progress()) / 2).
    default double
    jumpOut(double end, double start)
    The animation progress in the form of a initially quickly changing sine wave going from start to end based on the equation end + (start - end) * jumpOut().
    double
    Exposes the progress of the animation state, which is a number between 0 and 1 that represents how far the animation has progressed between its start and end.
    default double
    progress(double start, double end)
    The animation progress in the form of a value linearly growing from start to end based on the equation start + (end - start) * progress().
    default double
    A sine wave oscillating between 0 and 1 and back to 0 once per iteration.
    default double
    pulse(double start, double peak)
    A sine wave oscillating between start and peak and back to start once per iteration.
    default double
    The animation progress in the form of a value linearly growing from 1 to 0 based on the equation 1 - progress().
    default double
    regress(double end, double start)
    The animation regression in the form of a value linearly growing from start to end.
  • Method Details

    • progress

      double progress()
      Exposes the progress of the animation state, which is a number between 0 and 1 that represents how far the animation has progressed between its start and end. Note that an animation may also regress, in which case the states will transition from 1 to 0 instead of from 0 to 1. See Stride for more information.
      Returns:
      The animation progress in terms of a number between 0 and 1, where 0.5 means the animation is halfway through, and 1 means the animation completed.
    • progress

      default double progress(double start, double end)
      The animation progress in the form of a value linearly growing from start to end based on the equation start + (end - start) * progress(). At the beginning of the animation, the value is start, at the end of the animation, the value is end.
      Parameters:
      start - The start value of the animation.
      end - The end value of the animation.
      Returns:
      The animation progress in terms of a number between start and end.
    • regress

      default double regress()
      The animation progress in the form of a value linearly growing from 1 to 0 based on the equation 1 - progress(). At the beginning of the animation, the value is 1, at the end of the animation, the value is 0.
      Returns:
      The animation progress in terms of a number between 0 and 1, where 0.5 means the animation is halfway through.
    • regress

      default double regress(double end, double start)
      The animation regression in the form of a value linearly growing from start to end. This method is equivalent to progress(end, start).
      Parameters:
      end - The end value of the animation.
      start - The start value of the animation.
      Returns:
      The animation progress in terms of a number between start and end.
    • pulse

      default double pulse()
      A sine wave oscillating between 0 and 1 and back to 0 once per iteration. At the beginning of the animation, the value is 0, at the end of the animation, the value is 0 again, and when the animation is halfway through, the value is 1.
      Returns:
      The animation progress in terms of a number between 0 and 1, where 1 means the animation is halfway through.
    • pulse

      default double pulse(double start, double peak)
      A sine wave oscillating between start and peak and back to start once per iteration. At the beginning of the animation, the value is start, at the end of the animation, the value is start again, and when the animation is halfway through, the value is peak.
      Parameters:
      start - The start value of the sine wave.
      peak - The peak value of the sine wave.
      Returns:
      The animation progress in terms of a number between start and end, where end means the animation is halfway through.
    • jumpIn

      default double jumpIn()
      The animation progress in the form of quickly growing sine wave front going from 0 to 1 based on the equation sin(PI * progress() / 2). Just like the value returned by progress() the jumpIn() value starts at 0 and ends at 1, however the crucial difference is that the jumpIn() value grows according to a sine wave, which makes certain animations look more natural.
      The returned value will grow quickly at the beginning and slowly at the end, hence the name.
      Returns:
      The animation progress in the form of peaking sine wave growing from 0 to 1.
    • jumpIn

      default double jumpIn(double start, double end)
      The animation progress in the form of peaking sine wave growing from start to end based on the equation start + (end - start) * jumpIn(). Just like the value returned by progress() the jumpIn() value starts at start and ends at end, however the crucial difference is that the jumpIn() value grows according to a sine wave, which makes certain animations look more natural.
      The returned value will grow quickly at the beginning and slowly at the end, hence the name.
      Parameters:
      start - The start value of the animation.
      end - The end value of the animation.
      Returns:
      The animation progress in the form of peaking sine wave growing from start to end.
    • jumpOut

      default double jumpOut()
      The animation progress in the form of peaking sine wave growing from 1 to 0 based on the equation sin(PI * (1 - progress()) / 2). Just like the value returned by progress() the jumpOut() value starts at 1 and ends at 0, however the crucial difference is that the fadeOut() value grows according to a sine wave, which makes certain animations look more natural.
      Returns:
      The animation progress in the form of peaking sine wave growing from 1 to 0.
    • jumpOut

      default double jumpOut(double end, double start)
      The animation progress in the form of a initially quickly changing sine wave going from start to end based on the equation end + (start - end) * jumpOut(). Just like the value returned by progress(double, double) the jumpOut(double, double) value starts at start and ends at end, however the crucial difference is that the jumpOut(double, double) value changes according to a sine wave, which makes certain animations look more natural.
      Parameters:
      end - The end value of the animation,
      start - The start value of the animation.
      Returns:
      The animation progress in the form of peaking sine wave growing from start to end.
    • fadeIn

      default double fadeIn()
      The animation progress in the form of peaking sine wave growing from 0 to 1 based on the equation 0.5 * (1 + Math.sin( Math.PI * (progress() - 0.5) ) ) Just like the value returned by progress() the fadeIn() value starts at 0 and ends at 1, however the crucial difference is that the fadeIn() value grows according to a sine wave, which makes certain animations look more natural.
      The difference between this method and jumpIn() is that the returned value grows slower at the beginning, where jumpIn() grows faster initially.
      Returns:
      The animation progress in the form of peaking sine wave growing from 0 to 1.
    • fadeIn

      default double fadeIn(double start, double end)
      The animation progress in the form of peaking sine wave growing from start to end based on the equation start + (end - start) * fadeIn(). Just like the value returned by progress() the fadeIn() value starts at start and ends at end, however the crucial difference is that the fadeIn() value grows according to a sine wave, which makes certain animations look more natural.
      The difference between this method and jumpIn() is that the returned value grows slower at the beginning, where jumpIn() grows faster initially.
      Parameters:
      start - The start value of the animation.
      end - The end value of the animation.
      Returns:
      The animation progress in the form of a wave growing from start to end.
    • fadeOut

      default double fadeOut()
      The animation progress in the form of peaking sine wave growing from 1 to 0 based on the equation 1 - fadeIn(). Just like the value returned by progress() the fadeOut() value starts at 1 and ends at 0, however the crucial difference is that the fadeOut() value grows according to a sine wave, which makes certain animations look more natural.
      The difference between this method and jumpOut() is that the returned value grows slower at the beginning, where jumpOut() grows faster initially.
      Returns:
      The animation progress in the form of wave growing from 1 to 0.
    • fadeOut

      default double fadeOut(double end, double start)
      The animation progress in the form of a sine wave going from start to end based on the equation end + (start - end) * fadeOut(). Just like the value returned by progress(double, double) the fadeOut(double, double) value starts at start and ends at end, however the crucial difference is that the fadeOut(double, double) value grows according to a sine wave, which makes certain animations look more natural.
      The difference between this method and jumpOut() is that the returned value grows slower at the beginning, whereas jumpOut() grows faster initially.
      Parameters:
      end - The end value of the animation,
      start - The start value of the animation,
      Returns:
      The animation progress in the form a sine wave going from start to end.
    • cycle

      default double cycle()
      Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.

      This is especially useful for animations that are supposed to be repeated or whose start and end values are the same (e.g. a fade-in and fade-out animation).

      Returns:
      The animation progress in terms of a number between 0 and 1, where 1 means the animation is halfway through and 0 means the animation started or finished.
    • cyclePlus

      default double cyclePlus(double offset)
      Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.

      This is especially useful for animations that are supposed to be repeated or whose start and end values are the same (e.g. a fade-in and fade-out animation).

      This method is similar to cycle(), but it allows to offset the animation progress. This is useful for animations that are supposed to be repeated and whose start and end values are different (e.g. a fade-in and fade-out animation).

      Parameters:
      offset - The offset of the animation progress which may be any number. The modulo operator is used to offset the animation progress in a way that it is always between 0 and 1.
      Returns:
      The animation progress in terms of a number between 0 and 1, where 1 means the animation is halfway through and 0 means the animation started or finished.
    • cycleMinus

      default double cycleMinus(double offset)
      Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.

      This is especially useful for animations that are supposed to be repeated or whose start and end values are the same (e.g. a fade-in and fade-out animation).

      This method is similar to the of cyclePlus(double) but with the offset being subtracted instead of added. The returned values is similar to the one returned by cycle(), with the simple difference to offset the animation progress. This is useful for animations that are supposed to be repeated and whose start and end values are different (e.g. a fade-in and fade-out animation).

      Parameters:
      offset - The offset of the animation progress which may be any number. The modulo operator is used to offset the animation progress in a way that it is always between 0 and 1.
      Returns:
      The animation progress in terms of a number between 0 and 1, where 1 means the animation is halfway through and 0 means the animation started or finished.