# OnSwipe

Artifact: [androidx.constraintlayout:constraintlayout](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/motion/widget/OnSwipe.java+class:androidx.constraintlayout.motion.widget.OnSwipe) Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

*** ** * ** ***


```
public class OnSwipe
```

<br />

*** ** * ** ***

Container for holding swipe information

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#COMPLETE_MODE_CONTINUOUS_VELOCITY() = 0` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#COMPLETE_MODE_SPRING() = 1` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#DRAG_ANTICLOCKWISE() = 7` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#DRAG_CLOCKWISE() = 6` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#DRAG_DOWN() = 1` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#DRAG_END() = 5` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#DRAG_LEFT() = 2` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#DRAG_RIGHT() = 3` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#DRAG_START() = 4` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#DRAG_UP() = 0` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#FLAG_DISABLE_POST_SCROLL() = 1` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#FLAG_DISABLE_SCROLL() = 2` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#ON_UP_AUTOCOMPLETE() = 0` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#ON_UP_AUTOCOMPLETE_TO_END() = 2` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#ON_UP_AUTOCOMPLETE_TO_START() = 1` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#ON_UP_DECELERATE() = 4` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#ON_UP_DECELERATE_AND_COMPLETE() = 5` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#ON_UP_NEVER_TO_END() = 7` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#ON_UP_NEVER_TO_START() = 6` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#ON_UP_STOP() = 3` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SIDE_BOTTOM() = 3` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SIDE_END() = 6` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SIDE_LEFT() = 1` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SIDE_MIDDLE() = 4` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SIDE_RIGHT() = 2` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SIDE_START() = 5` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SIDE_TOP() = 0` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SPRING_BOUNDARY_BOUNCEBOTH() = 3` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SPRING_BOUNDARY_BOUNCEEND() = 2` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SPRING_BOUNDARY_BOUNCESTART() = 1` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#SPRING_BOUNDARY_OVERSHOOT() = 0` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#OnSwipe()()` |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getAutoCompleteMode()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getDragDirection()()` |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getDragScale()()` |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getDragThreshold()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getLimitBoundsTo()()` |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getMaxAcceleration()()` |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getMaxVelocity()()` |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getMoveWhenScrollAtTop()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getNestedScrollFlags()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getOnTouchUp()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getRotationCenterId()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getSpringBoundary()()` The behaviour at the boundaries 0 and 1 |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getSpringDamping()()` |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getSpringMass()()` Get the mass of the spring. the m in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getSpringStiffness()()` get the stiffness of the spring |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getSpringStopThreshold()()` The threshold for spring motion to stop. |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getTouchAnchorId()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getTouchAnchorSide()()` |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#getTouchRegionId()()` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setAutoCompleteMode(int)(int autoCompleteMode)` sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1; |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setDragDirection(int)(int dragDirection)` The direction of the drag. |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setDragScale(int)(int dragScale)` Normally 1 this can be tweaked to make the acceleration faster |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setDragThreshold(int)(int dragThreshold)` This sets the threshold before the animation is kicked off. |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setLimitBoundsTo(int)(int id)` Only allow touch actions to be initiated within this region |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setMaxAcceleration(int)(int maxAcceleration)` The maximum acceleration and deceleration of the animation (Change in Change in progress per second) Faster makes the object seem lighter and quicker |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setMaxVelocity(int)(int maxVelocity)` The maximum velocity (Change in progress per second) animation can achieve |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setMoveWhenScrollAtTop(boolean)(boolean moveWhenScrollAtTop)` When collaborating with a NestedScrollView do you progress form 0-1 only when the scroll view is at the top. |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setNestedScrollFlags(int)(int flags)` Various flag to control behaviours of nested scroll FLAG_DISABLE_POST_SCROLL = 1; FLAG_DISABLE_SCROLL = 2; |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setOnTouchUp(int)(int mode)` Configures what happens when the user releases on mouse up. |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setRotateCenter(int)(int rotationCenterId)` The view to center the rotation about |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setSpringBoundary(int)(int springBoundary)` The behaviour at the boundaries 0 and 1. |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setSpringDamping(float)(float springDamping)` Set the damping of the spring if using spring. c in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setSpringMass(float)(float springMass)` Set the Mass of the spring if using spring. m in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setSpringStiffness(float)(float springStiffness)` set the stiffness of the spring if using spring. |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setSpringStopThreshold(float)(float springStopThreshold)` set the threshold for spring motion to stop. |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setTouchAnchorId(int)(int side)` The id of the view who's movement is matched to your drag If not specified it will map to a linear movement across the width of the motionLayout |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setTouchAnchorSide(int)(int side)` This side of the view that matches the drag movement. |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe#setTouchRegionId(int)(int side)` |

## Constants

### COMPLETE_MODE_CONTINUOUS_VELOCITY

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int COMPLETE_MODE_CONTINUOUS_VELOCITY = 0
```

### COMPLETE_MODE_SPRING

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int COMPLETE_MODE_SPRING = 1
```

### DRAG_ANTICLOCKWISE

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int DRAG_ANTICLOCKWISE = 7
```

### DRAG_CLOCKWISE

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int DRAG_CLOCKWISE = 6
```

### DRAG_DOWN

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int DRAG_DOWN = 1
```

### DRAG_END

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int DRAG_END = 5
```

### DRAG_LEFT

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int DRAG_LEFT = 2
```

### DRAG_RIGHT

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int DRAG_RIGHT = 3
```

### DRAG_START

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int DRAG_START = 4
```

### DRAG_UP

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int DRAG_UP = 0
```

### FLAG_DISABLE_POST_SCROLL

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int FLAG_DISABLE_POST_SCROLL = 1
```

### FLAG_DISABLE_SCROLL

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int FLAG_DISABLE_SCROLL = 2
```

### ON_UP_AUTOCOMPLETE

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int ON_UP_AUTOCOMPLETE = 0
```

### ON_UP_AUTOCOMPLETE_TO_END

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int ON_UP_AUTOCOMPLETE_TO_END = 2
```

### ON_UP_AUTOCOMPLETE_TO_START

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int ON_UP_AUTOCOMPLETE_TO_START = 1
```

### ON_UP_DECELERATE

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int ON_UP_DECELERATE = 4
```

### ON_UP_DECELERATE_AND_COMPLETE

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int ON_UP_DECELERATE_AND_COMPLETE = 5
```

### ON_UP_NEVER_TO_END

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int ON_UP_NEVER_TO_END = 7
```

### ON_UP_NEVER_TO_START

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int ON_UP_NEVER_TO_START = 6
```

### ON_UP_STOP

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int ON_UP_STOP = 3
```

### SIDE_BOTTOM

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SIDE_BOTTOM = 3
```

### SIDE_END

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SIDE_END = 6
```

### SIDE_LEFT

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SIDE_LEFT = 1
```

### SIDE_MIDDLE

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SIDE_MIDDLE = 4
```

### SIDE_RIGHT

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SIDE_RIGHT = 2
```

### SIDE_START

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SIDE_START = 5
```

### SIDE_TOP

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SIDE_TOP = 0
```

### SPRING_BOUNDARY_BOUNCEBOTH

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SPRING_BOUNDARY_BOUNCEBOTH = 3
```

### SPRING_BOUNDARY_BOUNCEEND

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SPRING_BOUNDARY_BOUNCEEND = 2
```

### SPRING_BOUNDARY_BOUNCESTART

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SPRING_BOUNDARY_BOUNCESTART = 1
```

### SPRING_BOUNDARY_OVERSHOOT

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public static final int SPRING_BOUNDARY_OVERSHOOT = 0
```

## Public constructors

### OnSwipe

Added in 2.2.2

```
public OnSwipe()
```

## Public methods

### getAutoCompleteMode

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getAutoCompleteMode()
```

### getDragDirection

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getDragDirection()
```

### getDragScale

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public float getDragScale()
```

### getDragThreshold

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public float getDragThreshold()
```

### getLimitBoundsTo

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getLimitBoundsTo()
```

### getMaxAcceleration

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public float getMaxAcceleration()
```

### getMaxVelocity

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public float getMaxVelocity()
```

### getMoveWhenScrollAtTop

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public boolean getMoveWhenScrollAtTop()
```

### getNestedScrollFlags

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getNestedScrollFlags()
```

### getOnTouchUp

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getOnTouchUp()
```

### getRotationCenterId

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getRotationCenterId()
```

### getSpringBoundary

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getSpringBoundary()
```

The behaviour at the boundaries 0 and 1

| Returns |
|---|---|
| `int` |   |

### getSpringDamping

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public float getSpringDamping()
```

### getSpringMass

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public float getSpringMass()
```

Get the mass of the spring. the m in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring

| Returns |
|---|---|
| `float` |   |

### getSpringStiffness

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public float getSpringStiffness()
```

get the stiffness of the spring

| Returns |
|---|---|
| `float` | NaN if not set |

### getSpringStopThreshold

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public float getSpringStopThreshold()
```

The threshold for spring motion to stop.

| Returns |
|---|---|
| `float` |   |

### getTouchAnchorId

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getTouchAnchorId()
```

### getTouchAnchorSide

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getTouchAnchorSide()
```

### getTouchRegionId

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public int getTouchRegionId()
```

### setAutoCompleteMode

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public void setAutoCompleteMode(int autoCompleteMode)
```

sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1;

### setDragDirection

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setDragDirection(int dragDirection)
```

The direction of the drag.

| Parameters |
|---|---|
| `int dragDirection` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setDragScale

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setDragScale(int dragScale)
```

Normally 1 this can be tweaked to make the acceleration faster

| Parameters |
|---|---|
| `int dragScale` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setDragThreshold

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setDragThreshold(int dragThreshold)
```

This sets the threshold before the animation is kicked off. It is important when have multi state animations the have some play before the System decides which animation to jump on.

| Parameters |
|---|---|
| `int dragThreshold` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setLimitBoundsTo

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setLimitBoundsTo(int id)
```

Only allow touch actions to be initiated within this region

| Parameters |
|---|---|
| `int id` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setMaxAcceleration

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setMaxAcceleration(int maxAcceleration)
```

The maximum acceleration and deceleration of the animation (Change in Change in progress per second) Faster makes the object seem lighter and quicker

| Parameters |
|---|---|
| `int maxAcceleration` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setMaxVelocity

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setMaxVelocity(int maxVelocity)
```

The maximum velocity (Change in progress per second) animation can achieve

| Parameters |
|---|---|
| `int maxVelocity` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setMoveWhenScrollAtTop

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setMoveWhenScrollAtTop(boolean moveWhenScrollAtTop)
```

When collaborating with a NestedScrollView do you progress form 0-1 only when the scroll view is at the top.

| Parameters |
|---|---|
| `boolean moveWhenScrollAtTop` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setNestedScrollFlags

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setNestedScrollFlags(int flags)
```

Various flag to control behaviours of nested scroll FLAG_DISABLE_POST_SCROLL = 1; FLAG_DISABLE_SCROLL = 2;

| Parameters |
|---|---|
| `int flags` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setOnTouchUp

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setOnTouchUp(int mode)
```

Configures what happens when the user releases on mouse up. One of: ON_UP_AUTOCOMPLETE, ON_UP_AUTOCOMPLETE_TO_START, ON_UP_AUTOCOMPLETE_TO_END, ON_UP_STOP, ON_UP_DECELERATE, ON_UP_DECELERATE_AND_COMPLETE

| Parameters |
|---|---|
| `int mode` | default = ON_UP_AUTOCOMPLETE |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setRotateCenter

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setRotateCenter(int rotationCenterId)
```

The view to center the rotation about

| Parameters |
|---|---|
| `int rotationCenterId` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | this |

### setSpringBoundary

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setSpringBoundary(int springBoundary)
```

The behaviour at the boundaries 0 and 1. SPRING_BOUNDARY_OVERSHOOT = 0; SPRING_BOUNDARY_BOUNCE_START = 1; SPRING_BOUNDARY_BOUNCE_END = 2; SPRING_BOUNDARY_BOUNCE_BOTH = 3;

| Parameters |
|---|---|
| `int springBoundary` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setSpringDamping

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setSpringDamping(float springDamping)
```

Set the damping of the spring if using spring. c in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring

| Parameters |
|---|---|
| `float springDamping` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | this |

### setSpringMass

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setSpringMass(float springMass)
```

Set the Mass of the spring if using spring. m in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring

| Parameters |
|---|---|
| `float springMass` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` | this |

### setSpringStiffness

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setSpringStiffness(float springStiffness)
```

set the stiffness of the spring if using spring. If this is set the swipe will use a spring return system. If set to NaN it will revert to the norm system. K in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring

| Parameters |
|---|---|
| `float springStiffness` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setSpringStopThreshold

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setSpringStopThreshold(float springStopThreshold)
```

set the threshold for spring motion to stop. This is in change in progress / second If the spring will never go above that threshold again it will stop.

| Parameters |
|---|---|
| `float springStopThreshold` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setTouchAnchorId

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setTouchAnchorId(int side)
```

The id of the view who's movement is matched to your drag If not specified it will map to a linear movement across the width of the motionLayout

| Parameters |
|---|---|
| `int side` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setTouchAnchorSide

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setTouchAnchorSide(int side)
```

This side of the view that matches the drag movement. Only meaning full if the object changes size during the movement. (rotation is not considered)

| Parameters |
|---|---|
| `int side` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |

### setTouchRegionId

Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

```
public OnSwipe setTouchRegionId(int side)
```

| Parameters |
|---|---|
| `int side` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/OnSwipe` |   |