Interpolatable

Known direct subclasses
CornerBasedShape

Base class for Shapes defined by four CornerSizes.

LinearGradient

Brush implementation used to apply a linear gradient on a given Paint

RadialGradient

Brush implementation used to apply a radial gradient on a given Paint

SolidColor
SweepGradient

Brush implementation used to apply a sweep gradient on a given Paint

Known indirect subclasses
AbsoluteCutCornerShape

A shape describing the rectangle with cut corners.

AbsoluteRoundedCornerShape

A shape describing the rectangle with rounded corners.

CutCornerShape

A shape describing the rectangle with cut corners.

RoundedCornerShape

A shape describing the rectangle with rounded corners.


Represents an object which may be able to be linearly interpolated with another object. Usually used during animation.

Summary

Public companion functions

Any?
lerp(a: Any?, b: Any?, t: Float)

Attempt to Linearly interpolates between two values.

Cmn

Public functions

Any?
lerp(other: Any?, t: Float)

This method is defined such that a value of t being 1.0 means that the interpolation has finished, meaning that this method should return either other (or something equivalent to other), 0.0 meaning that the interpolation has not started, returning this (or something equivalent to this), and values in between meaning that the interpolation is at the relevant point on the timeline between this and other.

Cmn

Public companion functions

lerp

fun lerp(a: Any?, b: Any?, t: Float): Any?

Attempt to Linearly interpolates between two values. If either of the values are Interpolatable, this will attempt to use their lerp functions. If the interpolation is not possible, this will return a if t is less than 0.5 and b otherwise.

If a implements Interpolatable it will be attempted first.

Parameters
a: Any?

The start value.

b: Any?

The end value.

t: Float

The fraction to interpolate between the two values. This is usually between 0 and 1, but it is valid for it to be outside of this range.

Returns
Any?

The interpolated value.

Public functions

lerp

fun lerp(other: Any?, t: Float): Any?

This method is defined such that a value of t being 1.0 means that the interpolation has finished, meaning that this method should return either other (or something equivalent to other), 0.0 meaning that the interpolation has not started, returning this (or something equivalent to this), and values in between meaning that the interpolation is at the relevant point on the timeline between this and other. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid.

Note that the type of other may not be the same as the type of this, however if the implementation knows how to losslessly convert from one type to another, the conversion can be made in order to optimistically provide a valid interpolation.

If other is null, this can be interpreted as interpolating between "nothing" or, "no effect", into whatever the value of this is. In this case, if it is possible to construct a version of this type that is visually or semantically equivalent to "no effect", then it might make sense to return an interpolation between that value and this.

If there is no known way to interpolate between the two values, the implementation should return null.

Parameters
other: Any?

The other object to be intorpolated with this one.

t: Float

The position on the timeline. This is usually between 0 and 1, but it is valid for it to be outside of this range.

Returns
Any?

The interpolated object.

See also
Interpolatable

#lerp