CompositionSettings.Builder


public final class CompositionSettings.Builder


A builder for CompositionSettings instances.

Public constructors

Creates a new Builder.

Public methods

@NonNull CompositionSettings

Builds the CompositionSettings.

@NonNull CompositionSettings.Builder
setAlpha(@FloatRange(from = 0, to = 1) float alpha)

Sets the alpha.

@NonNull CompositionSettings.Builder
setOffset(
    @FloatRange(from = "-1", to = 1) float offsetX,
    @FloatRange(from = "-1", to = 1) float offsetY
)

Sets the offset.

@NonNull CompositionSettings.Builder
setScale(float scaleX, float scaleY)

Sets the scale.

Public constructors

Builder

Added in 1.5.0-alpha03
public Builder()

Creates a new Builder.

The default alpha is 1.0f, the default offset is (0.0f, 0.0f), the default scale is (1.0f, 1.0f).

Public methods

setAlpha

Added in 1.5.0-alpha03
public @NonNull CompositionSettings.Builder setAlpha(@FloatRange(from = 0, to = 1) float alpha)

Sets the alpha. 0 means fully transparent, 1 means fully opaque.

Parameters
@FloatRange(from = 0, to = 1) float alpha

alpha value.

Returns
@NonNull CompositionSettings.Builder

Builder instance.

setOffset

Added in 1.5.0-alpha03
public @NonNull CompositionSettings.Builder setOffset(
    @FloatRange(from = "-1", to = 1) float offsetX,
    @FloatRange(from = "-1", to = 1) float offsetY
)

Sets the offset.

Parameters
@FloatRange(from = "-1", to = 1) float offsetX

offset X value.

@FloatRange(from = "-1", to = 1) float offsetY

offset Y value.

Returns
@NonNull CompositionSettings.Builder

Builder instance.

setScale

Added in 1.5.0-alpha03
public @NonNull CompositionSettings.Builder setScale(float scaleX, float scaleY)

Sets the scale.

Parameters
float scaleX

scale X value.

float scaleY

scale Y value.

Returns
@NonNull CompositionSettings.Builder

Builder instance.

Discover the latest app development tools, platform updates, training, and documentation for developers across every Android device.

Updated Jul 18, 2024

The developer center about creating games for Android. Learn how to develop, optimize, and publish your Android game using the latest tools and SDKs.

Updated Aug 15, 2023

Learn about AI-enabled refactoring and documentation features.

Updated Dec 12, 2024