class SwipeMode


Defines the type of motion used when animating during touch-up.

See also
velocity
spring

Summary

Public companion functions

SwipeMode
spring(
    mass: Float,
    stiffness: Float,
    damping: Float,
    threshold: Float,
    boundary: SpringBoundary
)

Defines a spring based behavior during touch up for OnSwipe.

SwipeMode
velocity(maxVelocity: Float, maxAcceleration: Float)

Velocity based behavior during touch up for OnSwipe.

Public companion properties

SwipeMode

The default Spring based mode.

SwipeMode

The default Velocity based mode.

Public properties

String

Public companion functions

spring

Added in 1.1.0-alpha13
fun spring(
    mass: Float = 1.0f,
    stiffness: Float = 400.0f,
    damping: Float = 10.0f,
    threshold: Float = 0.01f,
    boundary: SpringBoundary = SpringBoundary.Overshoot
): SwipeMode

Defines a spring based behavior during touch up for OnSwipe.

Parameters
mass: Float = 1.0f

Mass of the spring, mostly affects the momentum that the spring carries. A spring with a larger mass will overshoot more and take longer to settle.

stiffness: Float = 400.0f

Stiffness of the spring, mostly affects the acceleration at the start of the motion. A spring with higher stiffness will move faster when pulled at a constant distance.

damping: Float = 10.0f

The rate at which the spring settles on its final position. A spring with larger damping value will settle faster on its final position.

threshold: Float = 0.01f

Distance in meters from the target point at which the bouncing motion of the spring is to be considered finished. 0.01 (1cm) by default. This value is typically small since the widget will jump to the final position once the spring motion ends, a large threshold value might cause the motion to end noticeably far from the target point.

boundary: SpringBoundary = SpringBoundary.Overshoot

Behavior of the spring bouncing motion as it crosses its target position. SpringBoundary.Overshoot by default.

velocity

Added in 1.1.0-alpha13
fun velocity(maxVelocity: Float = 4.0f, maxAcceleration: Float = 1.2f): SwipeMode

Velocity based behavior during touch up for OnSwipe.

Parameters
maxVelocity: Float = 4.0f

Maximum velocity in pixels/milliSecond

maxAcceleration: Float = 1.2f

Maximum acceleration in pixels/milliSecond^2

Public companion properties

Spring

Added in 1.1.0-alpha13
val SpringSwipeMode

The default Spring based mode.

Defined as spring(mass = 1f, stiffness = 400f, damping = 10f, threshold = 0.01f, boundary = SpringBoundary.Overshoot).

See also
spring

Velocity

Added in 1.1.0-alpha13
val VelocitySwipeMode

The default Velocity based mode.

Defined as velocity(maxVelocity = 4f, maxAcceleration = 1.2f).

See also
velocity

Public properties

name

Added in 1.1.0-alpha13
val nameString