TransformationVariableSpec

class TransformationVariableSpec


This class represents the configuration parameters for one variable that changes as the item moves on the screen and will be used to apply the corresponding transformation - for example: container alpha. When an item enters from the top of the screen the value of this variable will be topValue. As the item's bottom edge moves through the top transformation zone (inside the top transition area), this variable will change from topValue to target value (target value is the nominal value of this variable, with no transformation applied, such as 1f for alpha). When the item's top edge moves through the bottom transformation zone (inside the bottom transition area), this variable will change from the target value into bottomValue, and keep that value until it leaves the screen. The same process happens in reverse, entering from the bottom of the screen and leaving at the top.

Summary

Public constructors

TransformationVariableSpec(
    topValue: @FloatRange(from = 0.0, to = 1.0) Float,
    targetValue: @FloatRange(from = 0.0, to = 1.0) Float,
    bottomValue: @FloatRange(from = 0.0, to = 1.0) Float,
    transformationZoneEnterFraction: @FloatRange(from = 0.0, to = 1.0) Float,
    transformationZoneExitFraction: @FloatRange(from = 0.0, to = 1.0) Float
)

Public functions

TransformationVariableSpec
copy(
    topValue: Float,
    targetValue: Float,
    bottomValue: Float,
    transformationZoneEnterFraction: Float,
    transformationZoneExitFraction: Float
)

Returns a copy of the TransformationVariableSpec.

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

Float

The value this variable will have when the item's top edge is below the bottom transformation zone, usually this happens when it is (or is about to be) partially outside of the screen on the bottom side.

Float

The value this variable will have when the item is not in either transformation zone, and is in the "center" of the screen, i.e. the top edge is above the bottom transformation zone, and the bottom edge is below the top transformation zone.

Float

The value this variable will have when the item's bottom edge is above the top transformation zone, usually this happens when it is (or is about to be) partially outside of the screen on the top side.

Float

Defines how far into the transition area the transformation zone starts.

Float

Defines how far into the transition area the transformation zone ends.

Public constructors

TransformationVariableSpec

Added in 1.0.0-alpha33
TransformationVariableSpec(
    topValue: @FloatRange(from = 0.0, to = 1.0) Float,
    targetValue: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f,
    bottomValue: @FloatRange(from = 0.0, to = 1.0) Float = topValue,
    transformationZoneEnterFraction: @FloatRange(from = 0.0, to = 1.0) Float = 0.0f,
    transformationZoneExitFraction: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f
)

Public functions

copy

Added in 1.0.0-alpha33
fun copy(
    topValue: Float = this.topValue,
    targetValue: Float = this.targetValue,
    bottomValue: Float = this.bottomValue,
    transformationZoneEnterFraction: Float = this.transformationZoneEnterFraction,
    transformationZoneExitFraction: Float = this.transformationZoneExitFraction
): TransformationVariableSpec

Returns a copy of the TransformationVariableSpec.

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

bottomValue

Added in 1.0.0-alpha33
val bottomValueFloat

The value this variable will have when the item's top edge is below the bottom transformation zone, usually this happens when it is (or is about to be) partially outside of the screen on the bottom side.

targetValue

Added in 1.0.0-alpha33
val targetValueFloat

The value this variable will have when the item is not in either transformation zone, and is in the "center" of the screen, i.e. the top edge is above the bottom transformation zone, and the bottom edge is below the top transformation zone.

topValue

Added in 1.0.0-alpha33
val topValueFloat

The value this variable will have when the item's bottom edge is above the top transformation zone, usually this happens when it is (or is about to be) partially outside of the screen on the top side.

transformationZoneEnterFraction

Added in 1.0.0-alpha33
val transformationZoneEnterFractionFloat

Defines how far into the transition area the transformation zone starts. For example, a value of 0.5f means that when the item enters the screen from the top, this variable will not start to transform until the bottom of the item reaches the middle point of the transition area. Should be less than transformationZoneExitFraction.

Visually, the top transition area and top transformation zone can be visualized as:

       ˅  --------------------- <-- Top of the screen
| | |
| |-------------------| <- Enter fraction, item moving down
TA | | TZ | <- Transformation Zone
| |-------------------| <- Exit fraction, item moving down
| | |
^ |-------------------|

On the bottom, it is the same mirrored vertically (exit fraction is above enter fraction). It is also worth noting that in the bottom, it is the top of the item that triggers starting and ending transformations.

transformationZoneExitFraction

Added in 1.0.0-alpha33
val transformationZoneExitFractionFloat

Defines how far into the transition area the transformation zone ends. For example, a value of 0.5f means that when the item is moving down, its bottom edge needs to reach the middle point of the transition area for this variable to reach it's maximum/target value. Should be greater than transformationZoneEnterFraction.

See also transformationZoneEnterFraction