swipe

Function

Common

Deprecated Replaced by TouchInjectionScope. Use performTouchInput instead of performGesture

fun GestureScope.swipe(start: Offset, end: Offset, durationMillis: Long = 200) =
    delegateScope.touch { swipe(start, end, durationMillis) }

Performs the swipe gesture on the associated node. The motion events are linearly interpolated between start and end. The coordinates are in the node's local coordinate system, where (0, 0) is the top left corner of the node. The default duration is 200 milliseconds.

Parameters

startThe start position of the gesture, in the node's local coordinate system
endThe end position of the gesture, in the node's local coordinate system
durationMillisThe duration of the gesture
Common
fun TouchInjectionScope.swipe(start: Offset, end: Offset, durationMillis: Long = 200)

Performs a swipe gesture on the associated node.

The motion events are linearly interpolated between start and end. The coordinates are in the node's local coordinate system, where (0, 0) is the top left corner of the node. The default duration is 200 milliseconds.

Parameters

startThe start position of the gesture, in the node's local coordinate system
endThe end position of the gesture, in the node's local coordinate system
durationMillisThe duration of the gesture
Common
fun TouchInjectionScope.swipe(
    curve: (timeMillis: Long) -> Offset,
    durationMillis: Long = 200,
    keyTimes: List<Long> = emptyList(),
)

Performs a swipe gesture on the associated node.

The swipe follows the curve from 0 till durationMillis. Will force sampling of an event at all times defined in keyTimes. The time between events is kept as close to eventPeriodMillis as possible, given the constraints. The coordinates are in the node's local coordinate system, where (0, 0) is the top left corner of the node. The default duration is 200 milliseconds.

Parameters

curveThe function that describes the gesture. The argument passed to the function is the time in milliseconds since the start of the swipe, and the return value is the location of the pointer at that point in time.
durationMillisThe duration of the gesture
keyTimesAn optional list of timestamps in milliseconds at which a move event must be sampled