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 booleandoneprotected IMovementeasingFunctionprotected longlengthprotected java.lang.RunnablerunnableOnCancelprotected java.lang.RunnablerunnableOnStop -
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 voidapplyEffect(long currentTime)Apply this effect.voidcancel()Set the effect as done and run the cancel runnable.protected voiddoCancel()Run the onCancel runnable if any.voiddoEffect()voiddoEffect(long time)Apply effect to the target according to the given time.protected voiddoStop()Run the onStop runnable if any.longgetLength()Get effect lengthbooleanisDone()voidprocessEnd(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:IEffectSet the effect as done and run the cancel runnable.- Specified by:
cancelin 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:IEffectApply effect to the target according to the given time.- Specified by:
doEffectin 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:IEffectGet effect length- Specified by:
getLengthin interfaceIEffect- Returns:
- length (ms)
- See Also:
IEffect.getLength()
-
isDone
public boolean isDone()- Specified by:
isDonein 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.
-