Class TimelineEngine
java.lang.Object
org.pushingpixels.radiance.animation.api.TimelineEngine
The Radiance timeline engine. This is the main entry point to play
Timeline
s and
TimelineScenario
s. This class is for internal use only.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
Identifies a main object and an optional secondary ID.(package private) class
private class
(package private) static enum
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) TimelineEngine.RadianceAnimationThread
The timeline thread.private BlockingQueue
<Runnable> static boolean
Debug mode indicator.private static TimelineEngine
Single instance ofthis
class.(package private) long
(package private) static final Object
private Set
<TimelineScenario> All currently running timelines. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
abortTimeline
(Timeline timeline) Cancels the specified timeline instance.private void
addTimeline
(Timeline timeline) Adds the specified timeline.private void
callbackCallTimelinePulse
(Timeline timeline) private void
callbackCallTimelineScenarioEnded
(TimelineScenario timelineScenario) private void
callbackCallTimelineStateChanged
(Timeline timeline, Timeline.TimelineState oldState) void
Stops tracking of all timelines.private void
cancelTimeline
(Timeline timeline) Cancels the specified timeline instance.private void
endTimeline
(Timeline timeline) Ends the specified timeline instance.Returns an instance of the animator thread.Returns an instance of the callback thread.static TimelineEngine
Gets singleton instance.private Timeline
getRunningTimeline
(Timeline timeline) Returns an existing running timeline that matches the specified parameters.(package private) void
(package private) void
(package private) void
playReverse
(Timeline timeline, boolean reset, long msToSkip) (package private) void
playScenario
(TimelineScenario scenario) private void
resumeTimeline
(Timeline timeline) Resume the specified timeline instance.(package private) void
runTimelineOperation
(Timeline timeline, TimelineEngine.TimelineOperationKind operationKind, Runnable operationRunnable) (package private) void
runTimelineScenario
(Runnable timelineScenarioRunnable) private void
suspendTimeline
(Timeline timeline) Suspends the specified timeline instance.private void
updateAndEnforceTimelinePosition
(Timeline timeline) (package private) void
Updates all timelines that are currently registered withthis
tracker.
-
Field Details
-
DEBUG_MODE
public static boolean DEBUG_MODEDebug mode indicator. Set totrue
to print trace messages to console during development. -
instance
Single instance ofthis
class. -
runningTimelines
All currently running timelines. -
runningScenarios
-
lastIterationTimeStamp
long lastIterationTimeStamp -
animatorThread
TimelineEngine.RadianceAnimationThread animatorThreadThe timeline thread. -
callbackQueue
-
callbackThread
-
LOCK
-
-
Constructor Details
-
TimelineEngine
private TimelineEngine()Simple constructor. Defined private for singleton.- See Also:
-
-
Method Details
-
getInstance
Gets singleton instance.- Returns:
- Singleton instance.
-
updateTimelines
void updateTimelines()Updates all timelines that are currently registered withthis
tracker. -
callbackCallTimelineStateChanged
-
callbackCallTimelinePulse
-
callbackCallTimelineScenarioEnded
-
getRunningTimeline
Returns an existing running timeline that matches the specified parameters.- Parameters:
timeline
- Timeline.- Returns:
- An existing running timeline that matches the specified parameters.
-
addTimeline
Adds the specified timeline.- Parameters:
timeline
- Timeline to add.
-
play
-
playScenario
-
playReverse
-
playLoop
-
cancelAllTimelines
public void cancelAllTimelines()Stops tracking of all timelines. Note that this function does not stop the timeline engine thread (animatorThread
) and the timeline callback thread (callbackThread
). -
getAnimatorThread
Returns an instance of the animator thread.- Returns:
- The animator thread.
-
getCallbackThread
Returns an instance of the callback thread.- Returns:
- The animator thread.
-
cancelTimeline
Cancels the specified timeline instance.- Parameters:
timeline
- Timeline to cancel.
-
endTimeline
Ends the specified timeline instance.- Parameters:
timeline
- Timeline to end.
-
abortTimeline
Cancels the specified timeline instance.- Parameters:
timeline
- Timeline to cancel.
-
suspendTimeline
Suspends the specified timeline instance.- Parameters:
timeline
- Timeline to suspend.
-
resumeTimeline
Resume the specified timeline instance.- Parameters:
timeline
- Timeline to resume.
-
runTimelineOperation
void runTimelineOperation(Timeline timeline, TimelineEngine.TimelineOperationKind operationKind, Runnable operationRunnable) -
runTimelineScenario
-
updateAndEnforceTimelinePosition
-