Class Timeline
java.lang.Object
org.pushingpixels.radiance.animation.api.Timeline
- All Implemented Interfaces:
TimelineScenario.TimelineScenarioActor
- Direct Known Subclasses:
SwingComponentTimeline, SwingRepaintTimeline
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTimeline.BaseBuilder<T extends Timeline, B extends Timeline.BaseBuilder<?,?, ?>, M> static class(package private) classstatic enumprivate classstatic enumprivate class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) Timeline.Chainprivate static longIs used to create unique value for theidfield.private longstatic final longstatic final TimelineEaseprivate intprivate long(package private) floatTimeline position.private TimelineEase(package private) TimelineEngine.FullObjectID(package private) longUnique ID.private long(package private) booleanprivate Objectprivate booleanprivate Stringprivate List<TimelinePropertyBuilder.AbstractFieldInfo<?>> private Timeline.RepeatBehavior(package private) intprivate Comparable<?> private Stack<Timeline.TimelineState> (package private) floatTimeline position.(package private) long(package private) booleanIndication whether the looping timeline should stop at reaching the end of the cycle. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts this timeline.protected final voidaddCallback(TimelineCallback callback) static Timeline.Builderbuilder()static Timeline.Buildervoidcancel()Cancels this timeline.voidRequests that the specified timeline should stop at the end of the cycle.voidend()Ends this timeline.longfinal longfinal floatgetEase()protected static longgetId()Returns a unique ID.longgetName()Comparable<?> final Timeline.TimelineStategetState()final floatbooleanisDone()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) voidvoidplayReverseSkipping(long msToSkip) voidplaySkipping(long msToSkip) (package private) Timeline.TimelineStatepopState()static <T> TimelinePropertyBuilder<T> (package private) voidpushState(Timeline.TimelineState state) (package private) voidvoidreplay()voidvoidvoidresume()protected booleanbooleanvoidsuspend()toString()
-
Field Details
-
DEFAULT_DURATION
public static final long DEFAULT_DURATION- See Also:
-
DEFAULT_EASE
-
mainObject
-
secondaryId
-
fullObjectID
TimelineEngine.FullObjectID fullObjectID -
duration
private long duration -
initialDelay
private long initialDelay -
cycleDelay
private long cycleDelay -
isLooping
boolean isLooping -
repeatCount
int repeatCount -
repeatBehavior
-
mainObjectIsUiComponent
private boolean mainObjectIsUiComponent -
callbackChain
Timeline.Chain callbackChain -
name
-
propertiesToInterpolate
-
counter
private static long counterIs used to create unique value for theidfield. -
id
long idUnique ID. -
durationFraction
float durationFractionTimeline position. -
timelinePosition
float timelinePositionTimeline position. -
timeUntilPlay
long timeUntilPlay -
toCancelAtCycleBreak
boolean toCancelAtCycleBreakIndication whether the looping timeline should stop at reaching the end of the cycle. Relevant only whenisLoopingistrue. -
stateStack
-
ease
-
doneCount
private int doneCount
-
-
Constructor Details
-
Timeline
-
-
Method Details
-
builder
-
builder
-
addCallback
-
property
-
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
-
playLoopSkipping
-
playLoop
-
playLoopSkipping
-
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.- See Also:
-
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.- See Also:
-
abort
public void abort()Aborts this timeline. The timeline transitions to theTimeline.TimelineState.IDLEstate. 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
-
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
-
replaceState
-
pushState
-
popState
Timeline.TimelineState popState() -
getDuration
public final long getDuration() -
getInitialDelay
public long getInitialDelay() -
getCycleDelay
public long getCycleDelay() -
getRepeatBehavior
-
getName
-
getEase
-
getMainObject
-
getSecondaryId
-