Class BeatFade

java.lang.Object
com.oorian.css.animations.Animation
com.oorian.css.animations.BeatFade

public class BeatFade extends Animation
A looping animation that combines scaling and opacity changes for a pulsing effect.

The element fades to a lower opacity while scaling down, then fades back in while scaling up. This creates a subtle, attention-grabbing pulse that is softer than Beat alone.

Usage:


 // Default beat-fade animation
 icon.animate(new BeatFade());

 // Customize scale and opacity
 icon.animate(new BeatFade().setScale(1.3f).setMinOpacity(0.2f));
 
Since:
2026
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • BeatFade

      public BeatFade()
      Constructs a BeatFade animation with default settings and speed 1 (1000ms).
  • Method Details

    • setScale

      public BeatFade setScale(float scale)
      Sets the maximum scale factor for the beat effect.
      Parameters:
      scale - the scale factor at the peak (e.g., 1.125 for 112.5%)
      Returns:
      this BeatFade for method chaining
    • getScale

      public float getScale()
      Returns the maximum scale factor.
      Returns:
      the scale factor
    • setMinOpacity

      public BeatFade setMinOpacity(float minOpacity)
      Sets the minimum opacity during the fade-out phase.
      Parameters:
      minOpacity - the minimum opacity (0.0 = transparent, 1.0 = opaque)
      Returns:
      this BeatFade for method chaining
    • getMinOpacity

      public float getMinOpacity()
      Returns the minimum opacity.
      Returns:
      the minimum opacity 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
    • getTimingFunctionValue

      protected String getTimingFunctionValue()
      Returns the CSS timing function value as a string.

      By default, delegates to Animation.getDefaultTimingFunction(). Override this method to provide custom timing function values like cubic-bezier(...) or steps(...) that are not represented by the enum.

      Overrides:
      getTimingFunctionValue in class Animation
      Returns:
      the CSS timing function value