Class AbstractEffect
java.lang.Object
org.eclipse.nebula.animation.effects.AbstractEffect
- All Implemented Interfaces:
IEffect
- Direct Known Subclasses:
AlphaEffect
,CrossFadeEffect
,GalleryGroupResizeEffect
,GrowEffect
,MoveControlEffect
,MoveScrollBarEffect
,ResizeEffect
,SetBoundsEffect
,SetColorEffect
,ShakeEffect
public abstract class AbstractEffect extends java.lang.Object implements IEffect
Abstract implementation for an effect.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
done
protected IMovement
easingFunction
protected long
length
protected java.lang.Runnable
runnableOnCancel
protected java.lang.Runnable
runnableOnStop
-
Constructor Summary
Constructors Constructor Description AbstractEffect(long lengthMilli, IMovement movement)
Create a new effect.AbstractEffect(long lengthMilli, IMovement movement, java.lang.Runnable onStop, java.lang.Runnable onCancel)
Create a new effect, with listeners for stop and cancel events. -
Method Summary
Modifier and Type Method Description abstract void
applyEffect(long currentTime)
Apply this effect.void
cancel()
Set the effect as done and run the cancel runnable.protected void
doCancel()
Run the onCancel runnable if any.void
doEffect()
void
doEffect(long time)
Apply effect to the target according to the given time.protected void
doStop()
Run the onStop runnable if any.long
getLength()
Get effect lengthboolean
isDone()
void
processEnd(long time)
Check if the effect has ended.
-
Field Details
-
done
protected boolean done -
easingFunction
-
length
protected long length -
runnableOnCancel
protected java.lang.Runnable runnableOnCancel -
runnableOnStop
protected java.lang.Runnable runnableOnStop
-
-
Constructor Details
-
AbstractEffect
Create a new effect.- Parameters:
lengthMilli
-movement
-
-
AbstractEffect
public AbstractEffect(long lengthMilli, IMovement movement, java.lang.Runnable onStop, java.lang.Runnable onCancel)Create a new effect, with listeners for stop and cancel events.- Parameters:
lengthMilli
-movement
-onStop
-onCancel
-
-
-
Method Details
-
applyEffect
public abstract void applyEffect(long currentTime)Apply this effect.- Parameters:
currentTime
-
-
cancel
public void cancel()Description copied from interface:IEffect
Set the effect as done and run the cancel runnable.- Specified by:
cancel
in interfaceIEffect
- See Also:
IEffect.cancel()
-
doCancel
protected void doCancel()Run the onCancel runnable if any. -
doEffect
public void doEffect()- See Also:
org.eclipse.nebula.animation.effects.IEffect#doEffect()
-
doEffect
public void doEffect(long time)Description copied from interface:IEffect
Apply effect to the target according to the given time.- Specified by:
doEffect
in interfaceIEffect
- Parameters:
time
- - Current time in ms. This value may be larger than the effect length.- See Also:
IEffect.doEffect(long)
-
doStop
protected void doStop()Run the onStop runnable if any. -
getLength
public long getLength()Description copied from interface:IEffect
Get effect length- Specified by:
getLength
in interfaceIEffect
- Returns:
- length (ms)
- See Also:
IEffect.getLength()
-
isDone
public boolean isDone()- Specified by:
isDone
in interfaceIEffect
- Returns:
- true if the effect as already reached its end.
- See Also:
IEffect.isDone()
-
processEnd
public void processEnd(long time)Check if the effect has ended. In that case, start the onStop runnable.
-