Class Shake

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

public class Shake extends Animation
A looping animation that rapidly shakes an element back and forth with rotation.

The element rotates alternately left and right with decreasing intensity, creating an attention-grabbing shake effect similar to a notification alert.

Usage:


 // Continuous shake
 icon.animate(new Shake());

 // Shake 3 times then stop
 icon.animate(new Shake().setIterationCount(3));
 
Since:
2026
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Shake

      public Shake()
      Constructs a Shake animation with speed 1 (1000ms).
  • Method Details

    • 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