Class Timeline

java.lang.Object
org.pushingpixels.radiance.animation.api.Timeline
All Implemented Interfaces:
TimelineScenario.TimelineScenarioActor
Direct Known Subclasses:
SwingComponentTimeline, SwingRepaintTimeline

public class Timeline extends Object implements TimelineScenario.TimelineScenarioActor
The main entry point into Animation. Use builder() or builder(Object) and methods on the Timeline.BaseBuilder to configure one or more properties to be interpolated over a period of time. In the simplest case, a timeline operates on a single object passed to builder(Object), and one or more properties that have matching public setters. In that case, use the Timeline.BaseBuilder.addPropertyToInterpolate(String, Object, Object) API to configure which properties should be interpolated.

In a more complex case, use Timeline.BaseBuilder.addPropertyToInterpolate(TimelinePropertyBuilder) together with property(String) and TimelinePropertyBuilder.on(Object) to interpolate properties of multiple objects. TimelinePropertyBuilder.setWith(TimelinePropertyBuilder.PropertySetter), TimelinePropertyBuilder.getWith(TimelinePropertyBuilder.PropertyGetter) and TimelinePropertyBuilder.accessWith(TimelinePropertyBuilder.PropertyAccessor) can be used to work with properties that are not exposed via public setters or getters.

  • Field Details

  • Constructor Details

    • Timeline

      protected Timeline(Object mainTimelineObject)
  • Method Details

    • builder

      public static Timeline.Builder builder()
    • builder

      public static Timeline.Builder builder(Object mainTimelineObject)
    • addCallback

      protected final void addCallback(TimelineCallback callback)
    • property

      public static <T> TimelinePropertyBuilder<T> property(String propertyName)
    • shouldForceUiUpdate

      protected boolean shouldForceUiUpdate()
    • play

      public void play()
      Specified by:
      play in interface TimelineScenario.TimelineScenarioActor
    • playSkipping

      public void playSkipping(long msToSkip)
    • playReverse

      public void playReverse()
    • playReverseSkipping

      public void playReverseSkipping(long msToSkip)
    • replay

      public void replay()
    • replayReverse

      public void replayReverse()
    • playLoop

      public void playLoop(Timeline.RepeatBehavior repeatBehavior)
    • playLoopSkipping

      public void playLoopSkipping(Timeline.RepeatBehavior repeatBehavior, long msToSkip)
    • playLoop

      public void playLoop(int loopCount, Timeline.RepeatBehavior repeatBehavior)
    • playLoopSkipping

      public void playLoopSkipping(int loopCount, Timeline.RepeatBehavior repeatBehavior, long msToSkip)
    • cancel

      public void cancel()
      Cancels this timeline. The timeline transitions to the Timeline.TimelineState.CANCELLED state, preserving its current timeline position. After application callbacks and field interpolations are done on the Timeline.TimelineState.CANCELLED state, the timeline transitions to the Timeline.TimelineState.IDLE state. Application callbacks and field interpolations are done on this state as well.
      See Also:
    • end

      public void end()
      Ends this timeline. The timeline transitions to the Timeline.TimelineState.DONE state, with the timeline position set to 0.0 or 1.0 - based on the direction of the timeline. After application callbacks and field interpolations are done on the Timeline.TimelineState.DONE state, the timeline transitions to the Timeline.TimelineState.IDLE state. Application callbacks and field interpolations are done on this state as well.
      See Also:
    • abort

      public void abort()
      Aborts this timeline. The timeline transitions to the Timeline.TimelineState.IDLE state. No application callbacks or field interpolations are done.
      See Also:
    • suspend

      public void suspend()
    • resume

      public void resume()
    • cancelAtCycleBreak

      public void cancelAtCycleBreak()
      Requests that the specified timeline should stop at the end of the cycle. This method should be called only on looping timelines.
    • getId

      protected static long getId()
      Returns a unique ID.
      Returns:
      Unique ID.
    • getTimelinePosition

      public final float getTimelinePosition()
    • getDurationFraction

      public final float getDurationFraction()
    • getState

      public final Timeline.TimelineState getState()
    • isDone

      public boolean isDone()
      Specified by:
      isDone in interface TimelineScenario.TimelineScenarioActor
    • supportsReplay

      public boolean supportsReplay()
      Specified by:
      supportsReplay in interface TimelineScenario.TimelineScenarioActor
    • resetDoneFlag

      public void resetDoneFlag()
      Specified by:
      resetDoneFlag in interface TimelineScenario.TimelineScenarioActor
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDuration

      public final long getDuration()
    • getInitialDelay

      public long getInitialDelay()
    • getCycleDelay

      public long getCycleDelay()
    • getRepeatBehavior

      public Timeline.RepeatBehavior getRepeatBehavior()
    • getName

      public String getName()
    • getEase

      public TimelineEase getEase()
    • getMainObject

      public Object getMainObject()
    • getSecondaryId

      public Comparable<?> getSecondaryId()