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 class
Timeline.BaseBuilder<T extends Timeline,
B extends Timeline.BaseBuilder<?, ?, ?>, M> static class
(package private) class
static enum
private class
static enum
private class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Timeline.Chain
private static long
Is used to create unique value for theid
field.private long
static final long
static final TimelineEase
private int
private long
(package private) float
Timeline position.private TimelineEase
(package private) TimelineEngine.FullObjectID
(package private) long
Unique ID.private long
(package private) boolean
private Object
private boolean
private String
private List
<TimelinePropertyBuilder.AbstractFieldInfo<?>> private Timeline.RepeatBehavior
(package private) int
private Comparable
<?> private Stack
<Timeline.TimelineState> (package private) float
Timeline position.(package private) long
(package private) boolean
Indication whether the looping timeline should stop at reaching the end of the cycle. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
Aborts this timeline.protected final void
addCallback
(TimelineCallback callback) static Timeline.Builder
builder()
static Timeline.Builder
void
cancel()
Cancels this timeline.void
Requests that the specified timeline should stop at the end of the cycle.void
end()
Ends this timeline.long
final long
final float
getEase()
protected static long
getId()
Returns a unique ID.long
getName()
Comparable
<?> final Timeline.TimelineState
getState()
final float
boolean
isDone()
void
play()
void
playLoop
(int loopCount, Timeline.RepeatBehavior repeatBehavior) void
playLoop
(Timeline.RepeatBehavior repeatBehavior) void
playLoopSkipping
(int loopCount, Timeline.RepeatBehavior repeatBehavior, long msToSkip) void
playLoopSkipping
(Timeline.RepeatBehavior repeatBehavior, long msToSkip) void
void
playReverseSkipping
(long msToSkip) void
playSkipping
(long msToSkip) (package private) Timeline.TimelineState
popState()
static <T> TimelinePropertyBuilder
<T> (package private) void
pushState
(Timeline.TimelineState state) (package private) void
void
replay()
void
void
void
resume()
protected boolean
boolean
void
suspend()
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 theid
field. -
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 whenisLooping
istrue
. -
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:
play
in 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.CANCELLED
state, preserving its current timeline position. After application callbacks and field interpolations are done on theTimeline.TimelineState.CANCELLED
state, the timeline transitions to theTimeline.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 theTimeline.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 theTimeline.TimelineState.DONE
state, the timeline transitions to theTimeline.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 theTimeline.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
-
isDone
public boolean isDone()- Specified by:
isDone
in interfaceTimelineScenario.TimelineScenarioActor
-
supportsReplay
public boolean supportsReplay()- Specified by:
supportsReplay
in interfaceTimelineScenario.TimelineScenarioActor
-
resetDoneFlag
public void resetDoneFlag()- Specified by:
resetDoneFlag
in 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
-