Package com.luciad.view.animation
Class TLcdAnimation
java.lang.Object
com.luciad.view.animation.ALcdAnimation
com.luciad.view.animation.TLcdAnimation
- All Implemented Interfaces:
ILcdAnimation
Implementation of
ILcdAnimation which is lambda-friendly.
ALcdAnimation.setTime(double) method is implemented by delegating to a
Consumer<double>, which can be supplied to the constructor
of this class using a lambda. Similarly, the
start() and stop() methods are delegated to
a pair of Runnables also supplied at construction time.- Since:
- 2017.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.luciad.view.animation.ALcdAnimation
ALcdAnimation.Interpolator -
Constructor Summary
ConstructorsConstructorDescriptionTLcdAnimation(double aDuration, boolean aLoop, Consumer<Double> aFunction, ILcdView... aViews) Creates an animation which uses the givenConsumerin itsALcdAnimation.setTime(double)method.TLcdAnimation(double aDuration, boolean aLoop, Consumer<Double> aFunction, Runnable aBefore, Runnable aAfter, ILcdView... aViews) Same asTLcdAnimation(double, boolean, Consumer, ILcdView...), but also takes two runnables that are executed bystart()andstop(). -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the duration of this animation in seconds.booleanisLoop()If true,ALcdAnimationManagerwill play this animation repeatedly until it is explicitly terminated.voidrestart()protected voidsetTimeImpl(double aTime) Invokes theConsumerpassed to the constructor of this class.voidstart()Calls the runnable passed toTLcdAnimation(double, boolean, Consumer, Runnable, Runnable, ILcdView...).voidstop()Calls the runnable passed toTLcdAnimation(double, boolean, Consumer, Runnable, Runnable, ILcdView...).Methods inherited from class com.luciad.view.animation.ALcdAnimation
getInterpolator, interpolate, setInterpolator, setTime
-
Constructor Details
-
TLcdAnimation
public TLcdAnimation(double aDuration, boolean aLoop, Consumer<Double> aFunction, ILcdView... aViews) Creates an animation which uses the givenConsumerin itsALcdAnimation.setTime(double)method. Thestart()andstop()methods are empty when using this constructor.- Parameters:
aDuration- the duration of the animation in secondsaLoop- true if the animation should loopaFunction- implementation ofsetTime(), must not be nullaViews- the views that are affected by this animation
-
TLcdAnimation
public TLcdAnimation(double aDuration, boolean aLoop, Consumer<Double> aFunction, Runnable aBefore, Runnable aAfter, ILcdView... aViews) Same asTLcdAnimation(double, boolean, Consumer, ILcdView...), but also takes two runnables that are executed bystart()andstop().- Parameters:
aDuration- the duration of the animation in secondsaLoop- true if the animation should loopaFunction- implementation ofsetTime(), must not be nullaBefore- executed when the animation starts, must not be nullaAfter- executed when the animation stops, must not be nullaViews- the views that are affected by this animation
-
-
Method Details
-
getDuration
public double getDuration()Description copied from interface:ILcdAnimationReturns the duration of this animation in seconds. The duration of this animation should be a strictly positive finite value.- Specified by:
getDurationin interfaceILcdAnimation- Overrides:
getDurationin classALcdAnimation- Returns:
- the duration of this animation in seconds
-
start
public void start()Calls the runnable passed toTLcdAnimation(double, boolean, Consumer, Runnable, Runnable, ILcdView...).- Specified by:
startin interfaceILcdAnimation- Overrides:
startin classALcdAnimation
-
stop
public void stop()Calls the runnable passed toTLcdAnimation(double, boolean, Consumer, Runnable, Runnable, ILcdView...).- Specified by:
stopin interfaceILcdAnimation- Overrides:
stopin classALcdAnimation
-
isLoop
public boolean isLoop()Description copied from interface:ILcdAnimationIf true,ALcdAnimationManagerwill play this animation repeatedly until it is explicitly terminated. Each successive playback will be surrounded with a call toILcdAnimation.start()andILcdAnimation.stop().- Specified by:
isLoopin interfaceILcdAnimation- Overrides:
isLoopin classALcdAnimation- Returns:
- true if the animation should repeat, false if it should play once and then terminate
-
setTimeImpl
protected void setTimeImpl(double aTime) Invokes theConsumerpassed to the constructor of this class. The parameter passed to the consumer isaTime / getDuration(), i.e. a value between 0 and 1.- Specified by:
setTimeImplin classALcdAnimation- Parameters:
aTime- the duration (in seconds) for which the animation has been running
-
restart
public void restart()- Specified by:
restartin interfaceILcdAnimation- Overrides:
restartin classALcdAnimation
-