🌈 Create new beautiful Compose Gradients with our new wesite ->
Interface

ResponsiveTransformationSpec

Version of TransformationSpec that supports variable screen sizes.

Source set: Android
public sealed interface ResponsiveTransformationSpec : TransformationSpec

Version of TransformationSpec that supports variable screen sizes.

Use this API to define custom transformations for the items as they scroll across the screen.

Members

Companion

Source set: Android
public companion object

Functions

smallScreen

Source set: Android
public fun smallScreen(
            screenSize: Dp = ResponsiveTransformationSpecDefaults.SmallScreenSize,
            @FloatRange(from = 0.0, to = 1.0) minElementHeightFraction: Float = 0.2f,
            @FloatRange(from = 0.0, to = 1.0) maxElementHeightFraction: Float = 0.6f,
            @FloatRange(from = 0.0, to = 1.0) minTransitionAreaHeightFraction: Float = 0.35f,
            @FloatRange(from = 0.0, to = 1.0) maxTransitionAreaHeightFraction: Float = 0.55f,
            easing: Easing = CubicBezierEasing(0.3f, 0f, 0.7f, 1f),
            containerAlpha: TransformationVariableSpec = TransformationVariableSpec(0.5f),
            contentAlpha: TransformationVariableSpec = TransformationVariableSpec(0.5f),
            scale: TransformationVariableSpec = TransformationVariableSpec(0.7f),
        ): ResponsiveTransformationSpec

Default TransformationSpec for small screen size.

This spec should be used in rememberTransformationSpec together with the specs for alternative screen sizes, so that in-between screen sizes can be supported using interpolation.

Parameters

screenSize The size of the small screen.
minElementHeightFraction The minimum element height, as a ratio of the viewport height, to use for determining the transition area height within the range minTransitionAreaHeightFraction..maxTransitionAreaHeightFraction. Given a content item, this defines the start and end points for transitioning the item. Item heights lower than minElementHeightFraction will be treated as if minElementHeightFraction. Must be smaller than or equal to maxElementHeightFraction.
maxElementHeightFraction The maximum element height, as a ratio of the viewport height, to use for determining the transition area height within the range minTransitionAreaHeightFraction..maxTransitionAreaHeightFraction. Given a content item, this defines the start and end points for transitioning the item. Item heights higher than maxElementHeightFraction will be treated as if maxElementHeightFraction. Must be greater than or equal to minElementHeightFraction.
minTransitionAreaHeightFraction The lower bound of the range of heights for the transition area, i.e. how tall the transition area is for items of height minElementHeightFraction or shorter. Taller items will have taller transition areas, up to maxTransitionAreaHeightFraction. This is defined as a fraction (value between 0f..1f) of the viewport height. Must be less than or equal to maxTransitionAreaHeightFraction. Note that the transition area is the same for all variables, but each variable can define a transformation zone inside it in which the transformations will actually occur. See TransformationVariableSpec.
maxTransitionAreaHeightFraction The upper bound of the range of heights for the transition area, i.e. how tall the transition area is for items of height maxElementHeightFraction or taller. Shorter items will have shorter transition areas, down to minTransitionAreaHeightFraction. This is defined as a fraction (value between 0f..1f) of the viewport height. Must be greater than or equal to minTransitionAreaHeightFraction. Note that the transition area is the same for all variables, but each variable can define a transformation zone inside it in which the transformations will actually occur. See TransformationVariableSpec.
easing An interpolator to use to determine how to apply transformations as the item transitions across the transformation zones.
containerAlpha Configuration for how the container (background) of the item will fade in/out.
contentAlpha Configuration for how the content of the item will fade in/out.
scale Configuration for scaling the whole item (container and content).

largeScreen

Source set: Android
public fun largeScreen(
            screenSize: Dp = ResponsiveTransformationSpecDefaults.LargeScreenSize,
            @FloatRange(from = 0.0, to = 1.0) minElementHeightFraction: Float = 0.15f,
            @FloatRange(from = 0.0, to = 1.0) maxElementHeightFraction: Float = 0.45f,
            @FloatRange(from = 0.0, to = 1.0) minTransitionAreaHeightFraction: Float = 0.4f,
            @FloatRange(from = 0.0, to = 1.0) maxTransitionAreaHeightFraction: Float = 0.6f,
            easing: Easing = CubicBezierEasing(0.3f, 0f, 0.7f, 1f),
            containerAlpha: TransformationVariableSpec = TransformationVariableSpec(0.5f),
            contentAlpha: TransformationVariableSpec = TransformationVariableSpec(0.5f),
            scale: TransformationVariableSpec = TransformationVariableSpec(0.6f),
        ): ResponsiveTransformationSpec

Default TransformationSpec for large screen size.

This spec should be used in rememberTransformationSpec together with the specs for alternative screen sizes, so that in-between screen sizes can be supported using interpolation.

Parameters

screenSize The screen size of the large watch.
minElementHeightFraction The minimum element height, as a ratio of the viewport height, to use for determining the transition area height within the range minTransitionAreaHeightFraction..maxTransitionAreaHeightFraction. Given a content item, this defines the start and end points for transitioning the item. Item heights lower than minElementHeightFraction will be treated as if minElementHeightFraction. Must be smaller than or equal to maxElementHeightFraction.
maxElementHeightFraction The maximum element height, as a ratio of the viewport height, to use for determining the transition area height within the range minTransitionAreaHeightFraction..maxTransitionAreaHeightFraction. Given a content item, this defines the start and end points for transitioning the item. Item heights higher than maxElementHeightFraction will be treated as if maxElementHeightFraction. Must be greater than or equal to minElementHeightFraction.
minTransitionAreaHeightFraction The lower bound of the range of heights for the transition area, i.e. how tall the transition area is for items of height minElementHeightFraction or shorter. Taller items will have taller transition areas, up to maxTransitionAreaHeightFraction. This is defined as a fraction (value between 0f..1f) of the viewport height. Must be less than or equal to maxTransitionAreaHeightFraction. Note that the transition area is the same for all variables, but each variable can define a transformation zone inside it in which the transformations will actually occur. See TransformationVariableSpec.
maxTransitionAreaHeightFraction The upper bound of the range of heights for the transition area, i.e. how tall the transition area is for items of height maxElementHeightFraction or taller. Shorter items will have shorter transition areas, down to minTransitionAreaHeightFraction. This is defined as a fraction (value between 0f..1f) of the viewport height. Must be greater than or equal to minTransitionAreaHeightFraction. Note that the transition area is the same for all variables, but each variable can define a transformation zone inside it in which the transformations will actually occur. See TransformationVariableSpec.
easing An interpolator to use to determine how to apply transformations as the item transitions across the transformation zones.
containerAlpha Configuration for how the container (background) of the item will fade in/out.
contentAlpha Configuration for how the content of the item will fade in/out.
scale Configuration for scaling the whole item (container and content).