Bounce

data class Bounce(@FloatRange(from = 0.0, fromInclusive = false, to = 1.0) val lower: Float, @FloatRange(from = 1.0) val upper: Float)

Specifies how far the content can be scaled beyond its normal range while a zoom gesture is in progress. Once the gesture ends, the scale animates back into the normal range.

Both values are factors applied to the boundaries of the normal scale range, not absolute scale values. Note that the two are applied to different boundaries: lower is applied to the minimum scale, which is always 1.0, while upper is applied to ZoomState.maxScale.

For example, with a ZoomState whose maxScale is 5.0:

Bounce(lower = 0.8f, upper = 1.2f) // Scale can reach 0.8 while shrinking and 6.0 while enlarging.

Parameters

lower

The factor applied to the minimum scale of 1.0. Must be greater than 0.0 and at most 1.0. A value of 1.0 disables bouncing while shrinking.

upper

The factor applied to ZoomState.maxScale. Must be at least 1.0. A value of 1.0 disables bouncing while enlarging.

Constructors

Link copied to clipboard
constructor(@FloatRange(from = 0.0, fromInclusive = false, to = 1.0) lower: Float, @FloatRange(from = 1.0) upper: Float)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard