- java.lang.Object
-
- javafx.animation.KeyValue
-
public final class KeyValue extends Object
Defines a key value to be interpolated for a particular interval along the animation. AKeyFrame
, which defines a specific point on a timeline, can hold multipleKeyValues
.KeyValue
is an immutable class.A
KeyValue
is defined by a target, which is an implementation ofWritableValue
, an end value and anInterpolator
.Most interpolators define the interpolation between two
KeyFrames
. (The only exception are tangent-interpolators.) TheKeyValue
of the secondKeyFrame
(in forward direction) specifies the interpolator to be used in the interval.Tangent-interpolators define the interpolation to the left and to the right of a
KeyFrame
(seeInterpolator.TANGENT
).By default,
Interpolator.LINEAR
is used in the interval.- Since:
- JavaFX 2.0
- See Also:
Timeline
,KeyFrame
,Interpolator
-
-
Constructor Summary
Constructors Constructor Description KeyValue(WritableValue<T> target, T endValue)
Creates aKeyValue
that usesInterpolator.LINEAR
.KeyValue(WritableValue<T> target, T endValue, Interpolator interpolator)
Creates aKeyValue
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Indicates whether some other object is "equal to" this one.Object
getEndValue()
Returns the end value of thisKeyValue
Interpolator
getInterpolator()
Interpolator
to be used for calculating the key value along the particular interval.WritableValue<?>
getTarget()
Returns the target of thisKeyValue
int
hashCode()
Returns a hash code for thisKeyValue
object.String
toString()
Returns a string representation of thisKeyValue
object.
-
-
-
Constructor Detail
-
KeyValue
public KeyValue(WritableValue<T> target, T endValue, Interpolator interpolator)
Creates aKeyValue
.- Type Parameters:
T
- the type of theKeyValue
- Parameters:
target
- the targetendValue
- the end valueinterpolator
- theInterpolator
- Throws:
NullPointerException
- iftarget
orinterpolator
arenull
-
KeyValue
public KeyValue(WritableValue<T> target, T endValue)
Creates aKeyValue
that usesInterpolator.LINEAR
.- Type Parameters:
T
- the type of theKeyValue
- Parameters:
target
- the targetendValue
- the end value- Throws:
NullPointerException
- iftarget
orinterpolator
arenull
-
-
Method Detail
-
getTarget
public WritableValue<?> getTarget()
Returns the target of thisKeyValue
- Returns:
- the target
-
getEndValue
public Object getEndValue()
Returns the end value of thisKeyValue
- Returns:
- the end value
-
getInterpolator
public Interpolator getInterpolator()
Interpolator
to be used for calculating the key value along the particular interval. By default,Interpolator.LINEAR
is used.- Returns:
- the interpolator to be used for calculating the key value along the particular interval
-
toString
public String toString()
Returns a string representation of thisKeyValue
object.
-
hashCode
public int hashCode()
Returns a hash code for thisKeyValue
object.- Overrides:
hashCode
in classObject
- Returns:
- the hash code
- See Also:
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one. TwoKeyValues
are considered equal, if theirtarget
,endValue
, andinterpolator
are equal.- Overrides:
equals
in classObject
- Parameters:
obj
- the reference object with which to compare.- Returns:
true
if this object is the same as the obj argument;false
otherwise.- See Also:
Object.hashCode()
,HashMap
-
-