y.anim
Class AnimationPlayer

java.lang.Object
  |
  +--y.anim.AnimationPlayer

public class AnimationPlayer
extends Object

An animation player that interpretes a given animation object.

The animation player first calls AnimationObject.initAnimation(). Then it calls successively AnimationObject.calcNextFrame(int,int) with appropriate arguments until the animation has reached its last frame. Finally AnimationObject.disposeAnimation() gets called.

It is the responsibility to inform the AnimationListener of a AnimationObject when an animation frame has changed.


Constructor Summary
AnimationPlayer()
          Creates a new Instance of AnimationPlayer.
AnimationPlayer(double speedFactor)
          Creates a new Instance of AnimationPlayer with a given speed factor.
 
Method Summary
 void animate(AnimationObject anim)
          Processes the given AnimationObject and informs the AnimationListener whenever changes in the animation scene should be displayed.
 void decreaseSpeed()
          Decreases the speed factor of the animation by 50 percent.
 double getSpeed()
          Returns the speed factor of the animation player.
 boolean getSynchronizedMode()
          Whether or not the player is in synchronized mode.
 void increaseSpeed()
          Increases the speed factor of the animation by 50 percent
 void setSpeed(double speedFactor)
          Sets the speed factor for the player.
 void setSynchronizedMode(boolean sync)
          Set or resets synchronized mode of the player. the animation player should be used in synchronized mode whenever the player is run in a separate thread so that synchronization with the AWT thread is necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnimationPlayer

public AnimationPlayer()
Creates a new Instance of AnimationPlayer.


AnimationPlayer

public AnimationPlayer(double speedFactor)
Creates a new Instance of AnimationPlayer with a given speed factor.

Method Detail

animate

public void animate(AnimationObject anim)
Processes the given AnimationObject and informs the AnimationListener whenever changes in the animation scene should be displayed.


getSpeed

public double getSpeed()
Returns the speed factor of the animation player.


setSpeed

public void setSpeed(double speedFactor)
Sets the speed factor for the player. The speed factor is multiplied with the preferred duration of the animation object.

By default the speed factor is 1.0


increaseSpeed

public void increaseSpeed()
Increases the speed factor of the animation by 50 percent


decreaseSpeed

public void decreaseSpeed()
Decreases the speed factor of the animation by 50 percent.


setSynchronizedMode

public void setSynchronizedMode(boolean sync)
Set or resets synchronized mode of the player. the animation player should be used in synchronized mode whenever the player is run in a separate thread so that synchronization with the AWT thread is necessary.


getSynchronizedMode

public boolean getSynchronizedMode()
Whether or not the player is in synchronized mode.


© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003