Class TransitionGroup

java.lang.Object
com.oorian.css.transitions.TransitionGroup
All Implemented Interfaces:
TransitionStep

public class TransitionGroup extends Object implements TransitionStep
A group of transitions that play simultaneously.

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 Details

    • TransitionGroup

      public TransitionGroup()
      Constructs an empty TransitionGroup.
  • Method Details

    • add

      public TransitionGroup add(StyledElement<?> element, Transition transition)
      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 animate
      transition - 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 TransitionSequence to calculate cumulative delays.

      Specified by:
      getDurationMs in interface TransitionStep
      Returns:
      the duration in milliseconds
    • playForward

      public void playForward(long delayMs)
      Plays this step forward with the specified delay.
      Specified by:
      playForward in interface TransitionStep
      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:
      playReverse in interface TransitionStep
      Parameters:
      delayMs - the delay in milliseconds before the reverse transition starts
    • collectElements

      public void collectElements(Set<StyledElement<?>> elements)
      Collects all unique elements referenced by this step.

      Used by TransitionSequence to determine which elements participate in the sequence.

      Specified by:
      collectElements in interface TransitionStep
      Parameters:
      elements - the set to add elements to
    • getEntries

      public List<com.oorian.css.transitions.TransitionEntry> getEntries()
      Returns the element/transition pairs in this step.

      Used by TransitionSequence to build @keyframes animations from the step's transition definitions.

      Specified by:
      getEntries in interface TransitionStep
      Returns:
      a list of TransitionEntry objects