multiTouchSwipeWithVelocity
public fun TouchInjectionScope.multiTouchSwipeWithVelocity(
swipes: List<SwipeInfo>,
durationMillis: Long =
swipes.fastMaxOfOrNull {
VelocityPathFinder.calculateDefaultDuration(it.start, it.end, it.endVelocity)
} ?: 200L,
keyTimes: LongList = emptyLongList(),
): Unit
Performs a multi-touch swipe gesture on the associated node such that each pointer ends with the given velocity.
Each swipe will go through its start at t=0 and through its end at t=durationMillis. In between, the swipe will go monotonically from start to end, but not strictly. Due to imprecision, no guarantees can be made for the actual velocity at the end of the gesture, but generally it is within 0.1 of the desired velocity.
When a swipe cannot be created that results in the desired velocity (because the input is too restrictive), an exception will be thrown with suggestions to fix the input.
The coordinates are in the node's local coordinate system, where (0, 0) is the top left corner of the node.
Parameters
| swipes | The list of SwipeInfo configurations, one for each pointer. |
| durationMillis | The duration of the gesture in milliseconds. Must be long enough that at least 3 input events are generated, which happens with a duration of 40ms or more. If omitted, the default duration is the maximum of the default durations of the individual swipes, which are calculated such that a feasible swipe can be created that ends in the given velocity. |
| keyTimes | An optional list of timestamps in milliseconds at which a move event must be sampled |
Throws: IllegalArgumentException
When no swipe can be generated that will result in the desired velocity. The error message will suggest changes to the input parameters such that a swipe will become feasible.