pivot.wtk.effects
Class FlipTransition

java.lang.Object
  extended by pivot.wtk.effects.Transition
      extended by pivot.wtk.effects.FlipTransition

public class FlipTransition
extends Transition

Transition that appears to "flip" a single card over. It does this by using a CardPane with two cards in it; at the halfway point of the transition, it changes the selected card to give the illusion that the visual element has flipped over.

This class uses theta values from zero to π to represent the flip progress. Zero represents the first card being fully visible, π represents the second card being fully visible, and π/2 represents the halfway point. This class allows the caller to specify the begin and end theta to enable partial flips. Partial flips are useful when reversing a flip that is currently in progress.

When in progress, this transition assumes that the card pane has at least two cards and will only use the card pane's irst two cards. If the card pane has less than two cards when the transition is in progress, a runtime exception will be thrown.

Author:
tvolkert

Field Summary
 
Fields inherited from class pivot.wtk.effects.Transition
DEFAULT_DURATION, DEFAULT_RATE
 
Constructor Summary
FlipTransition(int duration, CardPane cardPane, double beginTheta, double endTheta)
           
 
Method Summary
 double getBeginTheta()
           
 double getCurrentTheta()
           
 double getEndTheta()
           
 void setBeginTheta(double beginTheta)
           
 void setEndTheta(double endTheta)
           
 void start(TransitionListener transitionListener)
          Starts the transition.
 void stop()
          Stops the transition.
protected  void update()
          Called repeatedly while the transition is running to update the transition's state.
 
Methods inherited from class pivot.wtk.effects.Transition
end, getCurrentTime, getDuration, getElapsedTime, getInterval, getPercentComplete, getRate, getStartTime, isRunning, setDuration, setRate, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlipTransition

public FlipTransition(int duration,
                      CardPane cardPane,
                      double beginTheta,
                      double endTheta)
Method Detail

getBeginTheta

public double getBeginTheta()

setBeginTheta

public void setBeginTheta(double beginTheta)

getEndTheta

public double getEndTheta()

setEndTheta

public void setEndTheta(double endTheta)

getCurrentTheta

public double getCurrentTheta()

start

public void start(TransitionListener transitionListener)
Description copied from class: Transition
Starts the transition. Calls Transition.update() to establish the initial state and starts a timer that will repeatedly call Transition.update() at the current rate. The specified TransitionListener will be notified when the transition completes.

Overrides:
start in class Transition
Parameters:
transitionListener - The listener to get notified when the transition completes, or null if no notification is necessary

stop

public void stop()
Description copied from class: Transition
Stops the transition. Does not fire a TransitionListener.transitionCompleted(Transition) event.

Overrides:
stop in class Transition

update

protected void update()
Description copied from class: Transition
Called repeatedly while the transition is running to update the transition's state.

Specified by:
update in class Transition