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 Runnable
s 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
ConstructorDescriptionTLcdAnimation
(double aDuration, boolean aLoop, Consumer<Double> aFunction, ILcdView... aViews) Creates an animation which uses the givenConsumer
in 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 TypeMethodDescriptiondouble
Returns the duration of this animation in seconds.boolean
isLoop()
If true,ALcdAnimationManager
will play this animation repeatedly until it is explicitly terminated.void
restart()
protected void
setTimeImpl
(double aTime) Invokes theConsumer
passed to the constructor of this class.void
start()
Calls the runnable passed toTLcdAnimation(double, boolean, Consumer, Runnable, Runnable, ILcdView...)
.void
stop()
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 givenConsumer
in 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:ILcdAnimation
Returns the duration of this animation in seconds. The duration of this animation should be a strictly positive finite value.- Specified by:
getDuration
in interfaceILcdAnimation
- Overrides:
getDuration
in 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:
start
in interfaceILcdAnimation
- Overrides:
start
in classALcdAnimation
-
stop
public void stop()Calls the runnable passed toTLcdAnimation(double, boolean, Consumer, Runnable, Runnable, ILcdView...)
.- Specified by:
stop
in interfaceILcdAnimation
- Overrides:
stop
in classALcdAnimation
-
isLoop
public boolean isLoop()Description copied from interface:ILcdAnimation
If true,ALcdAnimationManager
will play this animation repeatedly until it is explicitly terminated. Each successive playback will be surrounded with a call toILcdAnimation.start()
andILcdAnimation.stop()
.- Specified by:
isLoop
in interfaceILcdAnimation
- Overrides:
isLoop
in classALcdAnimation
- Returns:
- true if the animation should repeat, false if it should play once and then terminate
-
setTimeImpl
protected void setTimeImpl(double aTime) Invokes theConsumer
passed to the constructor of this class. The parameter passed to the consumer isaTime / getDuration()
, i.e. a value between 0 and 1.- Specified by:
setTimeImpl
in classALcdAnimation
- Parameters:
aTime
- the duration (in seconds) for which the animation has been running
-
restart
public void restart()- Specified by:
restart
in interfaceILcdAnimation
- Overrides:
restart
in classALcdAnimation
-