public final class KeyFrame extends Object
Timeline
.
The developer controls the interpolation of a set of variables for the
interval between successive key frames by providing a target value and an
Interpolator
associated with each variable. The variables are
interpolated such that they will reach their target value at the specified
time. An onFinished
function is invoked on each KeyFrame
if one
is provided. A KeyFrame
can optionally have a name
, which
will result in a cuepoint that is automatically added to the Timeline
.
Timeline
,
KeyValue
,
Interpolator
Constructor and Description |
---|
KeyFrame(Duration time,
EventHandler<ActionEvent> onFinished,
KeyValue... values)
Constructor of
KeyFrame |
KeyFrame(Duration time,
KeyValue... values)
Constructor of
KeyFrame |
KeyFrame(Duration time,
String name,
EventHandler<ActionEvent> onFinished,
Collection<KeyValue> values)
Constructor of
KeyFrame |
KeyFrame(Duration time,
String name,
EventHandler<ActionEvent> onFinished,
KeyValue... values)
Constructor of
KeyFrame |
KeyFrame(Duration time,
String name,
KeyValue... values)
Constructor of
KeyFrame |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
String |
getName()
Returns the
name of this KeyFrame . |
EventHandler<ActionEvent> |
getOnFinished()
Returns the
onFinished event handler of this KeyFrame . |
Duration |
getTime()
Returns the time offset of this
KeyFrame . |
Set<KeyValue> |
getValues()
Returns an immutable
Set of KeyValue instances. |
int |
hashCode()
Returns a hash code for this
KeyFrame object. |
String |
toString()
Returns a string representation of this
KeyFrame object. |
public KeyFrame(Duration time, String name, EventHandler<ActionEvent> onFinished, Collection<KeyValue> values)
KeyFrame
If a passed in KeyValue
is null
or a duplicate, it will
be ignored.
time
- the time
name
- the name
onFinished
- the onFinished-handler
values
- a ObservableList
of
KeyValue
instancesNullPointerException
- if time
is nullIllegalArgumentException
- if time
is invalid (see time
)public KeyFrame(Duration time, String name, EventHandler<ActionEvent> onFinished, KeyValue... values)
KeyFrame
If a passed in KeyValue
is null
or a duplicate, it will
be ignored.
time
- the time
name
- the name
onFinished
- the onFinished-handler
values
- the KeyValue
instancesNullPointerException
- if time
is nullIllegalArgumentException
- if time
is invalid (see time
)public KeyFrame(Duration time, EventHandler<ActionEvent> onFinished, KeyValue... values)
KeyFrame
time
- the time
onFinished
- the onFinished-handler
values
- the KeyValue
instancesNullPointerException
- if time
is nullIllegalArgumentException
- if time
is invalid (see time
)public KeyFrame(Duration time, String name, KeyValue... values)
KeyFrame
time
- the time
name
- the name
values
- the KeyValue
instancesNullPointerException
- if time
is nullIllegalArgumentException
- if time
is invalid (see time
)public KeyFrame(Duration time, KeyValue... values)
KeyFrame
time
- the time
values
- the KeyValue
instancesNullPointerException
- if time
is nullIllegalArgumentException
- if time
is invalid (see time
)public Duration getTime()
KeyFrame
.
The returned Duration
defines the time offset within
a single cycle of a Timeline
at which the KeyValues
will be set and at which the onFinished
function
variable will be called.
The time
of a KeyFrame
has to be greater than or equal to
Duration.ZERO
and it cannot be
Duration.UNKNOWN
.
Note: While the unit of time
is a millisecond, the granularity
depends on the underlying operating system and will in general be larger.
For example animations on desktop systems usually run with a maximum of
60fps which gives a granularity of ~17 ms.
public Set<KeyValue> getValues()
Set
of KeyValue
instances.
A KeyValue
defines a target and the desired value that should be
interpolated at the specified time of this KeyFrame
.public EventHandler<ActionEvent> getOnFinished()
onFinished
event handler of this KeyFrame
.
The onFinished
event handler is a function that is called when
the elapsed time on a cycle passes the specified time of this
KeyFrame
. The onFinished
function variable will be called
if the elapsed time passes the indicated value, even if it never equaled
the time value exactly.public String getName()
public String toString()
KeyFrame
object.public int hashCode()
KeyFrame
object.Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.