Interface Interpolatable<T>

Type Parameters:
T - the interpolatable value type
All Known Implementing Classes:
Background, BackgroundFill, BackgroundImage, BackgroundPosition, BackgroundSize, Border, BorderImage, BorderStroke, BorderWidths, Color, CornerRadii, ImagePattern, Insets, LinearGradient, Paint, Point2D, Point3D, RadialGradient, Stop
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Interpolatable<T>
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 Type
    Method
    Description
    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.
  • Method Details

    • interpolate

      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 Requirements:
      An implementation must accept any interpolation factor, but it can return a clamped intermediate value that falls within its value range.
      Parameters:
      endValue - the target value
      t - the interpolation factor
      Returns:
      the intermediate value
      Throws:
      NullPointerException - if endValue is null