|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.nebula.effects.stw.Transition
public abstract class Transition
An abstract class handling the basic actions required for whatever transition effect.
These actions are like the transition loop.
To implement a new transition effect, this class should be extended by the new transition
class and only the three methods initTransition(Image, Image, GC, double)
, stepTransition(long, Image, Image, GC, double)
and
endTransition(Image, Image, GC, double)
must be implemented.
The transition loop:
The
xitionImgGC.drawImage(from, 0, 0);
initTransition(from, to, xitionImgGC, direction);
render(xitionImgGC);
while(t <= T) {
if(t <= T) {
stepTransition(t, from, to, xitionImgGC, direction);
} else {
xitionImgGC.drawImage(to, 0, 0);
endTransition(from, to, xitionImgGC, direction);
}
render(xitionImgGC);
t += dt;
}
initTransition
method initializes the transition variables and draws the initial/first
frame of the transition effect at time 0. The stepTransition
method calculates the new transition variables values based on the time parameter t
and draws the transition effect at time instance t. Finally, the endTransition
method
finalizes the transition and draws the last frame at instance T.
Field Summary | |
---|---|
static long |
DEFAULT_FPS
The default fps (frames per second) is 60 |
static long |
DEFAULT_T
The default transition time is 1000 ms |
static double |
DIR_DOWN
The Down direction, 270 degrees |
static double |
DIR_LEFT
The Left direction, 180 degrees |
static double |
DIR_RIGHT
The Right direction, 0 degrees |
static double |
DIR_UP
The Up direction, 90 degrees |
Constructor Summary | |
---|---|
Transition(TransitionManager transitionManager)
This constructor is similar to new Transition(transitionManager, DEFAULT_FPS , DEFAULT_T ) |
|
Transition(TransitionManager transitionManager,
long fps,
long T)
Constructs a new transition object |
Method Summary | |
---|---|
long |
getFPS()
Returns the maximum number of frames per second |
double |
getTotalTransitionTime()
Returns the total time of the transition effect in millisecond |
void |
setFPS(long fps)
Sets the maximum fps (number of frames per second) for the transition. |
void |
setTotalTransitionTime(long T)
Sets the total time of the transition effect in milliseconds. |
void |
start(org.eclipse.swt.graphics.Image from,
org.eclipse.swt.graphics.Image to,
org.eclipse.swt.graphics.GC gc,
double direction)
Starts the transition from the from image to the to image drawing the effect on the graphics context object gc. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_FPS
public static final long DEFAULT_T
public static final double DIR_RIGHT
public static final double DIR_UP
public static final double DIR_LEFT
public static final double DIR_DOWN
Constructor Detail |
---|
public Transition(TransitionManager transitionManager, long fps, long T)
transitionManager
- the transition manager to be used to manage transitionsfps
- number of frames per secondT
- the total time the transition effect will takepublic Transition(TransitionManager transitionManager)
DEFAULT_FPS
, DEFAULT_T
)
transitionManager
- the transition manager to be used to manage transitionsMethod Detail |
---|
public final void setFPS(long fps)
fps
- maximum number of frames per secondpublic final long getFPS()
public final void setTotalTransitionTime(long T)
T
- total time of the transition effect in millisecondspublic final double getTotalTransitionTime()
public final void start(org.eclipse.swt.graphics.Image from, org.eclipse.swt.graphics.Image to, org.eclipse.swt.graphics.GC gc, double direction)
from
- is the image to start the transition fromto
- is the image to end the transition togc
- is the GC object to draw the transition ondirection
- determines the direction of the transition in degrees
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |