Class Flip


public class Flip extends Animation
A looping animation that flips an element around an axis.

By default, the element flips around the Y axis (horizontal flip). The flip axis and angle can be customized with setFlipAxis(String) and setAngle(String).

Usage:


 // Default Y-axis flip
 icon.animate(new Flip());

 // Flip around X axis
 icon.animate(new Flip().setFlipAxis("x"));

 // Custom flip angle
 icon.animate(new Flip().setAngle("-90deg"));
 
Since:
2026
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Flip

      public Flip()
      Constructs a Flip animation with default Y-axis flip and speed 1 (1000ms).
  • Method Details

    • setFlipAxis

      public Flip setFlipAxis(String axis)
      Sets the axis around which the element flips.
      Parameters:
      axis - the flip axis ("x", "y", or "z")
      Returns:
      this Flip for method chaining
    • getFlipAxis

      public String getFlipAxis()
      Returns the flip axis.
      Returns:
      the flip axis
    • setAngle

      public Flip setAngle(String angle)
      Sets the rotation angle for the flip.
      Parameters:
      angle - the rotation angle as a CSS value (e.g., "-180deg", "90deg")
      Returns:
      this Flip for method chaining
    • getAngle

      public String getAngle()
      Returns the flip angle.
      Returns:
      the flip angle CSS value
    • getKeyFramesId

      public String getKeyFramesId()
      Returns the unique ID for this animation's keyframes style element.

      This ID is used to deduplicate keyframe injection into the page head. Subclasses with configurable keyframes (e.g., Beat with a custom scale) should return a unique ID per configuration to avoid collisions.

      Specified by:
      getKeyFramesId in class Animation
      Returns:
      the keyframes style element ID
    • createKeyFrames

      public KeyFrames createKeyFrames()
      Creates the @keyframes definition for this animation.
      Specified by:
      createKeyFrames in class Animation
      Returns:
      a KeyFrames object defining the animation sequence
    • getDefaultTimingFunction

      protected AnimationTimingFunction getDefaultTimingFunction()
      Returns the default timing function for this animation.

      Each animation subclass provides its own default timing function. For custom cubic-bezier or steps timing, override Animation.getTimingFunctionValue() instead.

      Specified by:
      getDefaultTimingFunction in class Animation
      Returns:
      the default timing function, or null if Animation.getTimingFunctionValue() provides a custom value