public class TossHelper extends Object
A swipe is when a user presses, moves quickly, then releases. This helper helps to continue the dynamic of this movement. It needs to be coupled with a motion depending on the expected effect.
Modifier and Type | Method and Description |
---|---|
static int |
computeExpectedStop(int start,
float speed,
long duration)
Computes the expected stop considering the start value and the initial speed.
|
static int |
computeStop(int start,
int[] steps,
float speed,
long duration)
Chooses the nearest step as stop.
|
public static int computeExpectedStop(int start, float speed, long duration)
start
- the start value.speed
- the initial speed.duration
- the expected duration.public static int computeStop(int start, int[] steps, float speed, long duration)
start
- the start value.steps
- the steps values.speed
- the initial speed.duration
- the expected duration.