{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ScaleFactorKt

public final class ScaleFactorKt


Summary

Public methods

static final @NonNull ScaleFactor
ScaleFactor(float scaleX, float scaleY)

Constructs a ScaleFactor from the given x and y scale values

static final @NonNull Size
div(@NonNull Size receiver, @NonNull ScaleFactor scaleFactor)

Division operator with Size

static final boolean

false when this is ScaleFactor.Unspecified.

static final boolean

true when this is ScaleFactor.Unspecified.

static final @NonNull ScaleFactor
lerp(@NonNull ScaleFactor start, @NonNull ScaleFactor stop, float fraction)

Linearly interpolate between two ScaleFactor parameters

static final @NonNull ScaleFactor
takeOrElse(
    @NonNull ScaleFactor receiver,
    @NonNull Function0<@NonNull ScaleFactor> block
)

If this ScaleFactor then this is returned, otherwise block is executed and its result is returned.

static final @NonNull Size
times(@NonNull ScaleFactor receiver, @NonNull Size size)

Multiplication operator with Size with reverse parameter types to maintain commutative properties of multiplication

static final @NonNull Size
times(@NonNull Size receiver, @NonNull ScaleFactor scaleFactor)

Multiplication operator with Size.

Public methods

ScaleFactor

public static final @NonNull ScaleFactor ScaleFactor(float scaleX, float scaleY)

Constructs a ScaleFactor from the given x and y scale values

div

public static final @NonNull Size div(@NonNull Size receiver, @NonNull ScaleFactor scaleFactor)

Division operator with Size

Return a new Size with the width and height divided by ScaleFactor.scaleX and ScaleFactor.scaleY respectively

isSpecified

public static final boolean isSpecified(@NonNull ScaleFactor receiver)

false when this is ScaleFactor.Unspecified.

isUnspecified

public static final boolean isUnspecified(@NonNull ScaleFactor receiver)

true when this is ScaleFactor.Unspecified.

lerp

public static final @NonNull ScaleFactor lerp(@NonNull ScaleFactor start, @NonNull ScaleFactor stop, float fraction)

Linearly interpolate between two ScaleFactor parameters

The fraction argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning start (or something equivalent to start), 1.0 meaning that the interpolation has finished, returning stop (or something equivalent to stop), and values in between meaning that the interpolation is at the relevant point on the timeline between start and stop. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves).

Values for fraction are usually obtained from an Animation, such as an AnimationController.

takeOrElse

public static final @NonNull ScaleFactor takeOrElse(
    @NonNull ScaleFactor receiver,
    @NonNull Function0<@NonNull ScaleFactor> block
)

If this ScaleFactor then this is returned, otherwise block is executed and its result is returned.

times

public static final @NonNull Size times(@NonNull ScaleFactor receiver, @NonNull Size size)

Multiplication operator with Size with reverse parameter types to maintain commutative properties of multiplication

Return a new Size with the width and height multiplied by the ScaleFactor.scaleX and ScaleFactor.scaleY respectively

times

public static final @NonNull Size times(@NonNull Size receiver, @NonNull ScaleFactor scaleFactor)

Multiplication operator with Size.

Return a new Size with the width and height multiplied by the ScaleFactor.scaleX and ScaleFactor.scaleY respectively