T
- the type of the values at each frame.@Immutable @TrackPartiallyInitialized public static class KeyFrames.Frame<T> extends java.lang.Object
Client code should never mutate values that have been passed into a key frame.
Constructor and Description |
---|
KeyFrames.Frame(T value)
Constructs a new key frame.
|
KeyFrames.Frame(T value,
double atTimeFraction)
Constructs a new key frame.
|
KeyFrames.Frame(T value,
double atTimeFraction,
Interpolator interpolator)
Constructs a new key frame.
|
KeyFrames.Frame(T value,
Interpolator interpolator)
Constructs a new key frame.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
getClassOfValue()
This method returns the
Class object for the value of this frame. |
Interpolator |
getInterpolator()
Gets the interpolator that should be used between the previous key frame
and this one.
|
double |
getTimeFraction()
The time fraction in the range [0,1] when that key value defined by this
frame should occur.
|
T |
getValue()
The value of this key frame.
|
@RegionEffects(value="reads All") public KeyFrames.Frame(T value, double atTimeFraction, Interpolator interpolator)
value
- the value of this key frame. Client code should never
mutate values that have been passed into an instance.atTimeFraction
- the time fraction in the range [0,1] when the value should
occur. A negative value indicates, to the
KeyFrames.Builder
that this instance is passed to, that
the time fraction when this fame occurs should be calculated,
linearly, from the previous and next specified time fractions.interpolator
- the interpolator that should be used between the previous key
frame and this one. A null
value indicates, to the
KeyFrames.Builder
that this instance is passed to, that
either the interpolator set with
KeyFrames.Builder.setInterpolator(Interpolator)
or the
default LinearInterpolator
should be used for this key
frame.java.lang.IllegalArgumentException
- if value is null
.public KeyFrames.Frame(T value, double atTimeFraction)
The KeyFrames.Builder
that this instance is passed to will use
either the interpolator set with
KeyFrames.Builder.setInterpolator(Interpolator)
or the default
LinearInterpolator
to interpolate between the previous key frame
and this one.
value
- the value of this key frame. Client code should never
mutate values that have been passed into an instance.atTimeFraction
- the time fraction in the range [0,1] when the value should
occur. A negative value indicates, to the
KeyFrames.Builder
that this instance is passed to, that
the time fraction when this fame occurs should be calculated,
linearly, from the previous and next specified time fractions.java.lang.IllegalArgumentException
- if value is null
.public KeyFrames.Frame(T value, Interpolator interpolator)
The KeyFrames.Builder
that this instance is passed to will
calculate the time fraction when this fame occurs, linearly, from the
previous and next specified time fractions.
value
- the value of this key frame. Client code should never
mutate values that have been passed into an instance.interpolator
- the interpolator that should be used between the previous key
frame and this one. A null
value indicates, to the
KeyFrames.Builder
that this instance is passed to, that
either the interpolator set with
KeyFrames.Builder.setInterpolator(Interpolator)
or the
default LinearInterpolator
should be used for this key
frame.java.lang.IllegalArgumentException
- if value is null
.public KeyFrames.Frame(T value)
The KeyFrames.Builder
that this instance is passed to will
calculate the time fraction when this fame occurs, linearly, from the
previous and next specified time fractions.
The KeyFrames.Builder
that this instance is passed to will use
either the interpolator set with
KeyFrames.Builder.setInterpolator(Interpolator)
or the default
LinearInterpolator
to interpolate between the previous key frame
and this one.
value
- the value of this key frame.java.lang.IllegalArgumentException
- if value is null
.@NonNull public T getValue()
The returned value will never be null
.
@NonNull public java.lang.Class<?> getClassOfValue()
Class
object for the value of this frame.
It produces the same result as invoking
f.getValue().getClass()on a
KeyFrames.Frame
f.Class
object for the value of this frame.@RegionEffects(value="reads this:Instance") public double getTimeFraction()
The time fraction can be negative in the case that this instance was
created by client code to be passed to
KeyFrames.Builder.addFrame(KeyFrames.Frame)
and a constructor
that does not set the time fraction was called. A negative value
indicates to the KeyFrames.Builder
that the time fraction should
be calculated, linearly, from the previous and next specified time
fractions.
@Borrowed(value="this") @RegionEffects(value="none") @Nullable public Interpolator getInterpolator()
The return value may be null
in two cases:
KeyFrames
instance,
either through iteration or KeyFrames.getFrame(int)
, then a
null
value indicates that this is the first frame. Because the
interpolator is used to interpolate between the previous frame and this
one—the first frame has no intepolator.KeyFrames.Builder.addFrame(KeyFrames.Frame)
then a null
value indicates that either the interpolator set with
KeyFrames.Builder.setInterpolator(Interpolator)
or the default
LinearInterpolator
should be used for this key frame.null
.