SwipeMode
@ExperimentalMotionApi
class SwipeMode
Defines the type of motion used when animating during touch-up.
Summary
Public companion functions |
|
---|---|
SwipeMode |
Defines a spring based behavior during touch up for |
SwipeMode |
Velocity based behavior during touch up for |
Public companion properties |
|
---|---|
SwipeMode |
The default Spring based mode. |
SwipeMode |
The default Velocity based mode. |
Public companion functions
spring
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. |