/* * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package javafx.animation; import javafx.beans.NamedArg; import javafx.beans.value.WritableBooleanValue; import javafx.beans.value.WritableDoubleValue; import javafx.beans.value.WritableFloatValue; import javafx.beans.value.WritableIntegerValue; import javafx.beans.value.WritableLongValue; import javafx.beans.value.WritableNumberValue; import javafx.beans.value.WritableValue; /** * Defines a key value to be interpolated for a particular interval along the * animation. A {@link KeyFrame}, which defines a specific point on a timeline, * can hold multiple {@code KeyValues}. {@code KeyValue} is an immutable class. *
* A {@code KeyValue} is defined by a target, which is an implementation of * {@link javafx.beans.value.WritableValue}, an end value and an * {@link Interpolator}. *
* Most interpolators define the interpolation between two {@code KeyFrames}. * (The only exception are tangent-interpolators.) * The {@code KeyValue} of the second {@code KeyFrame} (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 {@code KeyFrame} (see {@link Interpolator#TANGENT(javafx.util.Duration, double, javafx.util.Duration, double) * Interpolator.TANGENT}). *
* By default, {@link Interpolator#LINEAR} is used in the interval.
*
* @see Timeline
* @see KeyFrame
* @see Interpolator
*
* @since JavaFX 2.0
*/
public final class KeyValue {
private static final Interpolator DEFAULT_INTERPOLATOR = Interpolator.LINEAR;
/**
* @treatAsPrivate implementation detail
* @deprecated This is an internal API that is not intended for use and will be removed in the next version
* @since JavaFX 2.0
*/
@Deprecated
public static enum Type {
BOOLEAN, DOUBLE, FLOAT, INTEGER, LONG, OBJECT
}
/**
* @treatAsPrivate implementation detail
* @deprecated This is an internal API that is not intended for use and will be removed in the next version
*/
@Deprecated
public Type getType() {
return type;
}
private final Type type;
/**
* Returns the target of this {@code KeyValue}
*
* @return the target
*/
public WritableValue> getTarget() {
return target;
}
private final WritableValue> target;
/**
* Returns the end value of this {@code KeyValue}
*
* @return the end value
*/
public Object getEndValue() {
return endValue;
}
private final Object endValue;
/**
* {@link Interpolator} to be used for calculating the key value along the
* particular interval. By default, {@link Interpolator#LINEAR} is used.
*/
public Interpolator getInterpolator() {
return interpolator;
}
private final Interpolator interpolator;
/**
* Creates a {@code KeyValue}.
*
* @param target
* the target
* @param endValue
* the end value
* @param interpolator
* the {@link Interpolator}
* @throws NullPointerException
* if {@code target} or {@code interpolator} are {@code null}
*/
public