Class TransitionGroup
- All Implemented Interfaces:
TransitionStep
TransitionGroup allows multiple element/transition pairs to be played at
the same time as a single step in a TransitionSequence. Each entry
pairs a StyledElement with a Transition. When played, all
entries start at the same time (with the same delay).
The group's duration is the maximum duration among all entries, ensuring that subsequent sequence steps wait for all entries to complete.
Usage:
TransitionGroup group = new TransitionGroup();
group.add(header, new Fade());
group.add(sidebar, new Slide().setDirection(Direction.LEFT));
TransitionSequence seq = new TransitionSequence();
seq.add(group);
seq.play();
- Since:
- 2026
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(StyledElement<?> element, Transition transition) Adds an element/transition pair to this group.voidcollectElements(Set<StyledElement<?>> elements) Collects all unique elements referenced by this step.longReturns the total duration of this step in milliseconds.List<com.oorian.css.transitions.TransitionEntry> Returns the element/transition pairs in this step.voidplayForward(long delayMs) Plays this step forward with the specified delay.voidplayReverse(long delayMs) Plays this step in reverse with the specified delay.
-
Constructor Details
-
TransitionGroup
public TransitionGroup()Constructs an empty TransitionGroup.
-
-
Method Details
-
add
Adds an element/transition pair to this group.The transition is added to the element via
StyledElement.addTransition(Transition)and will play simultaneously with all other entries in this group.- Parameters:
element- the element to animatetransition- the transition to apply- Returns:
- this group for method chaining
-
getDurationMs
public long getDurationMs()Returns the total duration of this step in milliseconds.For groups, this is the maximum duration among all entries. Used by
TransitionSequenceto calculate cumulative delays.- Specified by:
getDurationMsin interfaceTransitionStep- Returns:
- the duration in milliseconds
-
playForward
public void playForward(long delayMs) Plays this step forward with the specified delay.- Specified by:
playForwardin interfaceTransitionStep- Parameters:
delayMs- the delay in milliseconds before the transition starts
-
playReverse
public void playReverse(long delayMs) Plays this step in reverse with the specified delay.- Specified by:
playReversein interfaceTransitionStep- Parameters:
delayMs- the delay in milliseconds before the reverse transition starts
-
collectElements
Collects all unique elements referenced by this step.Used by
TransitionSequenceto determine which elements participate in the sequence.- Specified by:
collectElementsin interfaceTransitionStep- Parameters:
elements- the set to add elements to
-
getEntries
Returns the element/transition pairs in this step.Used by
TransitionSequenceto build@keyframesanimations from the step's transition definitions.- Specified by:
getEntriesin interfaceTransitionStep- Returns:
- a list of TransitionEntry objects
-