Enum Class AnimationFactory

java.lang.Object
java.lang.Enum<AnimationFactory>
io.github.palexdev.mfxeffects.animations.AnimationFactory
All Implemented Interfaces:
Serializable, Comparable<AnimationFactory>, Constable

public enum AnimationFactory extends Enum<AnimationFactory>
Convenience factory for various animations applied to Nodes.
See Also:
  • Enum Constant Details

  • Field Details

    • INTERPOLATOR_V1

      public static final javafx.animation.Interpolator INTERPOLATOR_V1
    • INTERPOLATOR_V2

      public static final javafx.animation.Interpolator INTERPOLATOR_V2
    • extraOffset

      public static double extraOffset
      This special variable is used in slide animations when the "travel distance" is computed. This extra offset is added to the computed value to ensure the node is outside the parent, for a smooth animation.
  • Method Details

    • values

      public static AnimationFactory[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AnimationFactory valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • computeDistanceLeft

      public double computeDistanceLeft(javafx.scene.Node node)
      Computes the distance between the node and the left side of its parent by using its Node.boundsInParentProperty(). This distance ensures the node is going to be outside/inside the parent towards the animation's ending.
      See Also:
    • computeDistanceRight

      public double computeDistanceRight(javafx.scene.Node node)

      Computes the distance between the node and the right side of its parent. For this computation the Node.parentProperty() must not return a null value (the node must be a child of some other node).

      If the parent is null, a 'fallback' value is returned: the width of the node plus the extra offset.

      Otherwise, the value is computed like this: parent.getLayoutBounds().getWidth() - node.getBoundsInParent().getMaxX() + node.getBoundsInParent().getWidth() + extraOffset

      See Also:
    • computeDistanceTop

      public double computeDistanceTop(javafx.scene.Node node)
      Computes the distance between the node and the top side of its parent by using its Node.boundsInParentProperty(). This distance ensures the node is going to be outside/inside the parent towards the animation's ending.
      See Also:
    • computeDistanceBottom

      public double computeDistanceBottom(javafx.scene.Node node)

      Computes the distance between the node and the bottom side of its parent. For this computation the Node.parentProperty() must not return a null value (the node must be a child of some other node).

      If the parent is null, a 'fallback' value is returned: the height of the node plus the extra offset.

      Otherwise, the value is computed like this: parent.getLayoutBounds().getHeight() - node.getBoundsInParent().getMaxY() + node.getBoundsInParent().getHeight() + extraOffset

      See Also:
    • build

      public javafx.animation.Timeline build(javafx.scene.Node node, double millis)
      Calls build(Node, double, Interpolator) with INTERPOLATOR_V1 as the default interpolator.
    • build

      public javafx.animation.Timeline build(javafx.scene.Node node, javafx.util.Duration duration)
      Calls build(Node, double) with the given duration converted to milliseconds.
    • build

      public javafx.animation.Timeline build(javafx.scene.Node node, javafx.util.Duration duration, javafx.animation.Interpolator i)
      Calls build(Node, double, Interpolator) with the given duration converted to milliseconds and the given interpolator.
    • build

      public javafx.animation.Timeline build(javafx.scene.Node node, double millis, javafx.animation.Interpolator i)
      Each enum constant will produce a Timeline with the given parameters.
      Parameters:
      node - the Node on which perform the animation
      millis - the duration of the animation in milliseconds
      i - the Interpolator used by the animations
    • keyFrames

      public abstract javafx.animation.KeyFrame[] keyFrames(javafx.scene.Node node, double millis, javafx.animation.Interpolator i)
      Each enum constant should produce the KeyFrames for the animation from the given parameters.