Package com.oorian.css.animations
Class Beat
java.lang.Object
com.oorian.css.animations.Animation
com.oorian.css.animations.Beat
A looping animation that scales an element up and back, creating a heartbeat effect.
By default, the element scales to 1.25x at the midpoint and returns to normal size.
The scale factor can be customized with setScale(float).
Usage:
// Default beat animation
icon.animate(new Beat());
// Beat with larger scale
icon.animate(new Beat().setScale(1.5f));
- Since:
- 2026
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBeat()Constructs a Beat animation with default scale (1.25) and speed 1 (1000ms). -
Method Summary
Modifier and TypeMethodDescriptionCreates the@keyframesdefinition for this animation.protected AnimationTimingFunctionReturns the default timing function for this animation.Returns the unique ID for this animation's keyframes style element.floatgetScale()Returns the maximum scale factor.setScale(float scale) Sets the maximum scale factor for the beat effect.Methods inherited from class com.oorian.css.animations.Animation
apply, getDurationMs, getStyleSheet, getTimingFunctionValue, setDelay, setDirection, setDuration, setFillMode, setIterationCount, setSpeed
-
Constructor Details
-
Beat
public Beat()Constructs a Beat animation with default scale (1.25) and speed 1 (1000ms).
-
-
Method Details
-
setScale
Sets the maximum scale factor for the beat effect.- Parameters:
scale- the scale factor at the peak of the beat (e.g., 1.25 for 125%)- Returns:
- this Beat for method chaining
-
getScale
public float getScale()Returns the maximum scale factor.- Returns:
- the scale factor
-
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:
getKeyFramesIdin classAnimation- Returns:
- the keyframes style element ID
-
createKeyFrames
Creates the@keyframesdefinition for this animation.- Specified by:
createKeyFramesin classAnimation- Returns:
- a KeyFrames object defining the animation sequence
-
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:
getDefaultTimingFunctionin classAnimation- Returns:
- the default timing function, or null if
Animation.getTimingFunctionValue()provides a custom value
-