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 java.lang.Object implements TimelineScenario.TimelineScenarioActor
The main entry point into Animation. Usebuilder()orbuilder(Object)and methods on theTimeline.BaseBuilderto 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 tobuilder(Object), and one or more properties that have matching public setters. In that case, use theTimeline.BaseBuilder.addPropertyToInterpolate(String, Object, Object)API to configure which properties should be interpolated.In a more complex case, use
Timeline.BaseBuilder.addPropertyToInterpolate(TimelinePropertyBuilder)together withproperty(String)andTimelinePropertyBuilder.on(Object)to interpolate properties of multiple objects.TimelinePropertyBuilder.setWith(TimelinePropertyBuilder.PropertySetter),TimelinePropertyBuilder.getWith(TimelinePropertyBuilder.PropertyGetter)andTimelinePropertyBuilder.accessWith(TimelinePropertyBuilder.PropertyAccessor)can be used to work with properties that are not exposed via public setters or getters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimeline.BaseBuilder<T extends Timeline,B extends Timeline.BaseBuilder<?,?,?>,M>static classTimeline.Builderstatic classTimeline.RepeatBehaviorstatic classTimeline.TimelineState
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_DURATIONstatic TimelineEaseDEFAULT_EASE
-
Constructor Summary
Constructors Modifier Constructor Description protectedTimeline(java.lang.Object mainTimelineObject)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()Aborts this timeline.protected voidaddCallback(TimelineCallback callback)static Timeline.Builderbuilder()static Timeline.Builderbuilder(java.lang.Object mainTimelineObject)voidcancel()Cancels this timeline.voidcancelAtCycleBreak()Requests that the specified timeline should stop at the end of the cycle.voidend()Ends this timeline.longgetCycleDelay()longgetDuration()floatgetDurationFraction()TimelineEasegetEase()protected static longgetId()Returns a unique ID.longgetInitialDelay()java.lang.ObjectgetMainObject()java.lang.StringgetName()Timeline.RepeatBehaviorgetRepeatBehavior()java.lang.Comparable<?>getSecondaryId()Timeline.TimelineStategetState()floatgetTimelinePosition()booleanisDone()voidplay()voidplayLoop(int loopCount, Timeline.RepeatBehavior repeatBehavior)voidplayLoop(Timeline.RepeatBehavior repeatBehavior)voidplayLoopSkipping(int loopCount, Timeline.RepeatBehavior repeatBehavior, long msToSkip)voidplayLoopSkipping(Timeline.RepeatBehavior repeatBehavior, long msToSkip)voidplayReverse()voidplayReverseSkipping(long msToSkip)voidplaySkipping(long msToSkip)static <T> TimelinePropertyBuilder<T>property(java.lang.String propertyName)voidreplay()voidreplayReverse()voidresetDoneFlag()voidresume()protected booleanshouldForceUiUpdate()booleansupportsReplay()voidsuspend()java.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_DURATION
public static final long DEFAULT_DURATION
- See Also:
- Constant Field Values
-
DEFAULT_EASE
public static final TimelineEase DEFAULT_EASE
-
-
Method Detail
-
builder
public static Timeline.Builder builder()
-
builder
public static Timeline.Builder builder(java.lang.Object mainTimelineObject)
-
addCallback
protected final void addCallback(TimelineCallback callback)
-
property
public static <T> TimelinePropertyBuilder<T> property(java.lang.String propertyName)
-
shouldForceUiUpdate
protected boolean shouldForceUiUpdate()
-
play
public void play()
- Specified by:
playin interfaceTimelineScenario.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 theTimeline.TimelineState.CANCELLEDstate, preserving its current timeline position. After application callbacks and field interpolations are done on theTimeline.TimelineState.CANCELLEDstate, the timeline transitions to theTimeline.TimelineState.IDLEstate. Application callbacks and field interpolations are done on this state as well.
-
end
public void end()
Ends this timeline. The timeline transitions to theTimeline.TimelineState.DONEstate, 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 theTimeline.TimelineState.DONEstate, the timeline transitions to theTimeline.TimelineState.IDLEstate. Application callbacks and field interpolations are done on this state as well.
-
abort
public void abort()
Aborts this timeline. The timeline transitions to theTimeline.TimelineState.IDLEstate. No application callbacks or field interpolations are done.
-
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:
isDonein interfaceTimelineScenario.TimelineScenarioActor
-
supportsReplay
public boolean supportsReplay()
- Specified by:
supportsReplayin interfaceTimelineScenario.TimelineScenarioActor
-
resetDoneFlag
public void resetDoneFlag()
- Specified by:
resetDoneFlagin interfaceTimelineScenario.TimelineScenarioActor
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getDuration
public final long getDuration()
-
getInitialDelay
public long getInitialDelay()
-
getCycleDelay
public long getCycleDelay()
-
getRepeatBehavior
public Timeline.RepeatBehavior getRepeatBehavior()
-
getName
public java.lang.String getName()
-
getEase
public TimelineEase getEase()
-
getMainObject
public java.lang.Object getMainObject()
-
getSecondaryId
public java.lang.Comparable<?> getSecondaryId()
-
-