Class SpringAnimation.Builder<B extends SpringAnimation.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
SpringAnimation

public static class SpringAnimation.Builder<B extends SpringAnimation.Builder<B>> extends Animation.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public SpringAnimation build()
      Finish building the SpringAnimation object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to SpringAnimation.
      Overrides:
      build in class Animation.Builder<B extends SpringAnimation.Builder<B>>
      Returns:
      a new instance of SpringAnimation with the properties that were set in the Builder object.
    • setClamp

      public B setClamp(boolean clamp)

      Whether the animation should be clamped.

      If set to TRUE, the animation will abruptly end as soon as it reaches the final value, preventing overshooting.

      It won't prevent overshooting SpringAnimation:value-from if a relative negative SpringAnimation:initial-velocity is set.

      Parameters:
      clamp - the value for the clamp property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEpsilon

      public B setEpsilon(double epsilon)

      Precision of the spring.

      The level of precision used to determine when the animation has come to a rest, that is, when the amplitude of the oscillations becomes smaller than this value.

      If the epsilon value is too small, the animation will take a long time to stop after the animated value has stopped visibly changing.

      If the epsilon value is too large, the animation will end prematurely.

      The default value is 0.001.

      Parameters:
      epsilon - the value for the epsilon property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setInitialVelocity

      public B setInitialVelocity(double initialVelocity)

      The initial velocity to start the animation with.

      Initial velocity affects only the animation curve, but not its duration.

      Parameters:
      initialVelocity - the value for the initial-velocity property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSpringParams

      public B setSpringParams(SpringParams springParams)
      Physical parameters describing the spring.
      Parameters:
      springParams - the value for the spring-params property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setValueFrom

      public B setValueFrom(double valueFrom)

      The value to animate from.

      The animation will start at this value and end at SpringAnimation:value-to.

      Parameters:
      valueFrom - the value for the value-from property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setValueTo

      public B setValueTo(double valueTo)

      The value to animate to.

      The animation will start at SpringAnimation:value-from and end at this value.

      Parameters:
      valueTo - the value for the value-to property
      Returns:
      the Builder instance is returned, to allow method chaining