| 
 | Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.anim.AnimationPlayer
public class AnimationPlayer
An animation player that interprets a given animation object.
The animation player first callsAnimationObject.initAnimation().
 Then it repeatedly calls AnimationObject.calcFrame(double) with an appropriate
 time argument in the range 0.0 to 1.0.
 The animation player tries to achieve the configured target frames-per-second
 rate (FPS) with which it calls the calcFrame method.
 The actual frequency of calls, however, largely depends on the preferred duration
 of an animation object and the actual progress of its animation.
 When the animation gets stuck, frames are skipped, i.e. the FPS effectively drops.
 Finally, AnimationObject.disposeAnimation() gets called.
 
 The player notifies interested parties when it begins processing
 animations, when a new animation frame should be displayed, and when it
 stops processing animations.
 Typically, a Graph2DView or a
 Graph2DViewRepaintManager is registered as an
 AnimationListener and triggers appropriate repaints when
 notified.
 
 The player supports two modes of operation: blocking and non-blocking.
 In blocking mode, the player's animate method blocks until
 the passed in animation is completely processed.
 In non-blocking mode, the animate method immediately returns
 and subsequent calls will schedule the passed in animations for
 concurrent processing.
 While in non-blocking mode, the isPlaying method can be used to
 determine if the player is processing animations.
animate(AnimationObject), 
isBlocking(), 
setBlocking(boolean), 
isPlaying()| Constructor Summary | |
|---|---|
| AnimationPlayer()Creates a new instance of AnimationPlayer. | |
| AnimationPlayer(boolean blocking)Creates a new instance of AnimationPlayer using the given blocking mode policy. | |
| AnimationPlayer(double speedFactor)Creates a new instance of AnimationPlayer with the given speed factor. | |
| AnimationPlayer(double speedFactor,
                boolean blocking)Creates a new instance of AnimationPlayer with the given speed factor and blocking mode policy. | |
| Method Summary | |
|---|---|
|  void | addAnimationListener(AnimationListener listener)Adds an AnimationListenerto theAnimationObject. | 
|  void | animate(AnimationObject anim)Processes the given AnimationObjectand informs the
 AnimationListener whenever changes in the animation scene should be
 displayed. | 
|  void | decreaseSpeed()Decreases the speed factor of the animation by 33 percent. | 
|  int | getFps()Returns the target frames-per-second rate (FPS), which the player tries to achieve. | 
|  double | getSpeed()Returns the speed factor of the animation player. | 
|  void | increaseSpeed()Increases the speed factor of the animation by 50 percent. | 
|  boolean | isBlocking()Returns whether the player is currently in blocking mode. | 
|  boolean | isInEventDispatchThread()Returns trueif the player is running in the AWT event
 dispatch thread. | 
|  boolean | isPlaying()Returns whether the player is currently processing animations. | 
|  boolean | isSynchronized()Returns whether or not the player is in synchronized mode. | 
|  void | removeAnimationListener(AnimationListener listener)Removes an AnimationListenerfrom theAnimationObject. | 
|  void | setBlocking(boolean blocking)Specifies whether the player's animatemethod should block or
 return immediately. | 
|  void | setFps(int fps)Specifies the target frames-per-second rate (FPS), which the player tries to achieve. | 
|  void | setSpeed(double speedFactor)Sets the speed factor for the player. | 
|  void | setSynchronized(boolean sync)Specifies whether the player should synchronize itself with the AWT event thread. | 
|  void | stop()Stops the timer and disposes all animations. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public AnimationPlayer()
1.0.
 By default, this AnimationPlayer will synchronize with the AWT event thread and will use a target rate of 120 frames-per-second (FPS).
public AnimationPlayer(double speedFactor,
                       boolean blocking)
By default, this AnimationPlayer will synchronize with the AWT event thread and will use a target rate of 120 frames-per-second (FPS).
public AnimationPlayer(double speedFactor)
By default, this AnimationPlayer will synchronize with the AWT event thread and will use a target rate of 120 frames-per-second rate (FPS).
public AnimationPlayer(boolean blocking)
1.0.
 By default, this AnimationPlayer will synchronize with the AWT event thread and will use a target rate of 120 frames-per-second (FPS).
| Method Detail | 
|---|
public void addAnimationListener(AnimationListener listener)
AnimationListener to the AnimationObject.
listener - the AnimationListener to be addedpublic void removeAnimationListener(AnimationListener listener)
AnimationListener from the
 AnimationObject.
listener - the AnimationListener to be removedpublic int getFps()
public void setFps(int fps)
fps - Target FPS, which the player tries to achieve.public boolean isSynchronized()
public void setSynchronized(boolean sync)
public boolean isInEventDispatchThread()
true if the player is running in the AWT event
 dispatch thread.
true if the player is running in the AWT event
 dispatch thread.public boolean isBlocking()
true, the player's animate
 method blocks until the passed in animation is completely processed.
 If this method returns false, the player's
 animate method immediately returns after being called and
 subsequent calls will result in the newly passed in animations to be
 processed concurrently with already scheduled ones.
public void setBlocking(boolean blocking)
animate method should block or
 return immediately.
 If the player is set up to have its animate method return
 immediately, subsequent calls will result in the newly passed in animations
 to be processed concurrently with already scheduled ones.
blocking - if true, the player's animate
                   method blocks;
                   if false, the animate method
                   will return immediately.public void animate(AnimationObject anim)
AnimationObject and informs the
 AnimationListener whenever changes in the animation scene should be
 displayed.
 Depending on the blocking property, this method either blocks
 until the specified AnimationObject is completely processed or
 returns immediately and allows for additional AnimationObjects
 to be scheduled for concurrent processing.
anim - the AnimationObject to be processedsetBlocking(boolean), 
isBlocking()public boolean isPlaying()
public double getSpeed()
public void setSpeed(double speedFactor)
1.0
public void increaseSpeed()
public void decreaseSpeed()
public void stop()
| 
 | © Copyright 2000-2025, yWorks GmbH. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||