org.zilonis.tool.ext.aerith.animation
Class ScreenTransition

java.lang.Object
  extended by org.zilonis.tool.ext.aerith.animation.ScreenTransition

public class ScreenTransition
extends java.lang.Object

This class is used to facilitate animated transitions in an application. ScreenTransition is given a container in a Swing application. When the application wishes to transition from one state of the application to another, the startTransition method is called, which calls back into the application to first reset the state of the application, then set up the following state of the application. Then ScreenTransition runs an animation from the previous state of the application to the new state. REMIND: There is some confusion in this and the effects package about the use of Component vs JComponent... If this framework is primarily intended for Swing, then maybe it would be good to standardize on JComponent?


Constructor Summary
ScreenTransition(javax.swing.JComponent transitionComponent, TransitionTarget transitionTarget)
          Constructor for ScreenTransition.
 
Method Summary
 void begin()
          Override of TimingTarget.begin(); nothing to do here.
 void end()
          Override of TimingTarget.end(); switch the visibility of the containerLayer and animationLayer and force repaint.
 java.awt.Container getContentPane()
          Returns the content pane used in this ScreenTransition.
 boolean isTransitioning()
          Utility method to query whether a transition is currently taking place
 void repeat()
           
 void startTransition(int transitionTimeMS)
          Begin the transition from the current application state to the next one.
 void timingEvent(float elapsedFraction)
          Implementation of the TimingTarget interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScreenTransition

public ScreenTransition(javax.swing.JComponent transitionComponent,
                        TransitionTarget transitionTarget)
Constructor for ScreenTransition. The application must supply the JComponent that they wish to transition and the TransitionTarget which supplies the callback methods called during the transition process.

Parameters:
transitionComponent - JComponent that the application wishes to run the transition on.
transitionTarget - Implementation of TransitionTarget interface which will be called during transition process.
Method Detail

getContentPane

public java.awt.Container getContentPane()
Returns the content pane used in this ScreenTransition. Applications can add components directly to this container if they wish (although adding components to ScreenTransition will have the same effect).


timingEvent

public void timingEvent(float elapsedFraction)
Implementation of the TimingTarget interface. This method is called repeatedly during the transition animation. We change the animation fraction in the AnimationManager and then force a repaint, which will force the current transition state to be rendered.


begin

public void begin()
Override of TimingTarget.begin(); nothing to do here.


end

public void end()
Override of TimingTarget.end(); switch the visibility of the containerLayer and animationLayer and force repaint.


isTransitioning

public boolean isTransitioning()
Utility method to query whether a transition is currently taking place


startTransition

public void startTransition(int transitionTimeMS)
Begin the transition from the current application state to the next one. This method will call twice into the TransitionTarget specified in the ScreenTransition constructor: resetCurrentScreen() will be called to allow the application to clean up the current screen and setupNextScreen() will be called to allow the application to set up the state of the next screen. After these calls, the transition animation will begin. REMIND: should be called from EDT only?

Parameters:
transitionTimeMS - The length of this transition in milliseconds

repeat

public void repeat()