Package com.oorian.css
Class KeyFrames
java.lang.Object
com.oorian.css.CssElement
com.oorian.css.KeyFrames
Represents a CSS @keyframes animation rule for defining animation sequences.
KeyFrames allows you to define CSS animations programmatically by specifying keyframe rules at various points in the animation timeline.
Example usage:
KeyFrames fadeIn = new KeyFrames("fadeIn");
fadeIn.addRule("from", "opacity: 0");
fadeIn.addRule("to", "opacity: 1");
This generates:
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRule(KeyFrameRule rule) Adds a keyframe rule to this animation.Adds a keyframe rule with a CSS selector and style object.Adds a keyframe rule with a CSS selector and style string.toString()Converts this keyframes definition to a CSS string.Methods inherited from class com.oorian.css.CssElement
addNewLine, create, initializeChildren
-
Constructor Details
-
KeyFrames
Constructs a new keyframes animation with the specified name.- Parameters:
name- The animation name used to reference this keyframes definition in CSS animations.
-
-
Method Details
-
addRule
Adds a keyframe rule to this animation.- Parameters:
rule- The KeyFrameRule to add.- Returns:
- This KeyFrames for method chaining.
-
addRule
Adds a keyframe rule with a CSS selector and style object.- Parameters:
selector- The keyframe selector (e.g., "from", "to", "0%", "50%", "100%").style- The CssStyle containing the properties for this keyframe.- Returns:
- This KeyFrames for method chaining.
-
addRule
Adds a keyframe rule with a CSS selector and style string.- Parameters:
selector- The keyframe selector (e.g., "from", "to", "0%", "50%", "100%").style- The CSS properties as a string (e.g., "opacity: 0; transform: scale(0.5)").- Returns:
- This KeyFrames for method chaining.
-
toString
Converts this keyframes definition to a CSS string.
-