APIdia Launch Partner
Top Description Methods
javafx.animation

public Interface Interpolatable<T>

Known Direct Implementers
javafx.geometry.Insets, javafx.geometry.Point2D, javafx.geometry.Point3D, javafx.scene.layout.Background, javafx.scene.layout.BackgroundFill, javafx.scene.layout.BackgroundImage, javafx.scene.layout.BackgroundPosition, javafx.scene.layout.BackgroundSize, javafx.scene.layout.Border, javafx.scene.layout.BorderImage, javafx.scene.layout.BorderStroke, javafx.scene.layout.BorderWidths, javafx.scene.layout.CornerRadii, javafx.scene.paint.Paint, javafx.scene.paint.Stop, com.sun.javafx.scene.layout.region.BorderImageSlices, com.sun.javafx.scene.layout.region.Margins
Annotations
@FunctionalInterface
Type Parameters
<T>
the interpolatable value type

A value that can be interpolated. It defines a single interpolate(Object, double) method, which returns an intermediate value between the value of this Interpolatable and the specified target value.

Component values can be interpolated in different ways, depending on the semantics of the component type:

Interpolation types
default Component types that implement Interpolatable are interpolated by calling the interpolate(Object, double) method.
linear Two components are combined by linear interpolation such that the intermediate value is produced by computing (1 - t) * start + t * end. Note that this formula produces values less than start for t < 0 and values greater than end for t > 1. This interpolation type is usually applicable for numeric components.
discrete If two components cannot be meaningfully combined, the intermediate component value is equal to the start value for t < 0.5 and equal to the end value for t >= 0.5.
pairwise Two lists are combined by pairwise interpolation. Paired list elements are interpolated with rules as described in this table (substituting "component" for "element"). If the start list has fewer elements than the target list, the missing elements are copied from the target list. If the start list has more elements than the target list, the excess elements are discarded.
Some component types are interpolated in specific ways not covered here. Refer to their respective documentation for more information.
Since
JavaFX 2.0

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

the intermediate value
interpolate
(T
the target value
endValue
,
double
the interpolation factor
t
)

Returns an intermediate value between the value of this Interpolatable and the specified endValue using the linear interpolation factor t.

Method Detail

interpolateback to summary
public T interpolate(T endValue, double t)

Returns an intermediate value between the value of this Interpolatable and the specified endValue using the linear interpolation factor t. The interpolation factor can be any finite value.

The returned value might not be a new instance; the implementation might also return one of the two existing instances if the intermediate value would be equal to one of the existing values. However, this is an optimization and applications should not assume any particular identity of the returned value.

Implementation Specification

An implementation must accept any interpolation factor, but it can return a clamped intermediate value that falls within its value range.

Parameters
endValue:T

the target value

t:double

the interpolation factor

Returns:T

the intermediate value

Exceptions
NullPointerException:
if endValue is null