# ArcMotion

Artifact: [androidx.transition:transition](https://developer.android.com/jetpack/androidx/releases/transition) [View Source](https://cs.android.com/search?q=file:androidx/transition/ArcMotion.java+class:androidx.transition.ArcMotion) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/transition#1.0.0)

*** ** * ** ***


```
public class ArcMotion extends PathMotion
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.transition.PathMotion](https://developer.android.com/reference/androidx/transition/PathMotion) ||
|   | ↳ | [androidx.transition.ArcMotion](https://developer.android.com/reference/androidx/transition/ArcMotion) |

*** ** * ** ***

A PathMotion that generates a curved path along an arc on an imaginary circle containing the two points. If the horizontal distance between the points is less than the vertical distance, then the circle's center point will be horizontally aligned with the end point. If the vertical distance is less than the horizontal distance then the circle's center point will be vertically aligned with the end point.

When the two points are near horizontal or vertical, the curve of the motion will be small as the center of the circle will be far from both points. To force curvature of the path, `https://developer.android.com/reference/androidx/transition/ArcMotion#setMinimumHorizontalAngle(float)` and `https://developer.android.com/reference/androidx/transition/ArcMotion#setMinimumVerticalAngle(float)` may be used to set the minimum angle of the arc between two points.

This may be used in XML as an element inside a transition.

```
<changeBounds>
  <arcMotion android:minimumHorizontalAngle="15"
             android:minimumVerticalAngle="0"
             android:maximumAngle="90"/>
</changeBounds>
```

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/transition/ArcMotion#ArcMotion()()` |
| `https://developer.android.com/reference/androidx/transition/ArcMotion#ArcMotion(android.content.Context,android.util.AttributeSet)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/AttributeSet.html attrs)` |

| ### Public methods |
|---|---|
| `float` | `https://developer.android.com/reference/androidx/transition/ArcMotion#getMaximumAngle()()` Returns the maximum arc along the circle between two points. |
| `float` | `https://developer.android.com/reference/androidx/transition/ArcMotion#getMinimumHorizontalAngle()()` Returns the minimum arc along the circle between two points aligned near horizontally. |
| `float` | `https://developer.android.com/reference/androidx/transition/ArcMotion#getMinimumVerticalAngle()()` Returns the minimum arc along the circle between two points aligned near vertically. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Path.html` | `https://developer.android.com/reference/androidx/transition/ArcMotion#getPath(float,float,float,float)(float startX, float startY, float endX, float endY)` Provide a Path to interpolate between two points `(startX, startY)` and `(endX, endY)`. |
| `void` | `https://developer.android.com/reference/androidx/transition/ArcMotion#setMaximumAngle(float)(float angleInDegrees)` Sets the maximum arc along the circle between two points. |
| `void` | `https://developer.android.com/reference/androidx/transition/ArcMotion#setMinimumHorizontalAngle(float)(float angleInDegrees)` Sets the minimum arc along the circle between two points aligned near horizontally. |
| `void` | `https://developer.android.com/reference/androidx/transition/ArcMotion#setMinimumVerticalAngle(float)(float angleInDegrees)` Sets the minimum arc along the circle between two points aligned near vertically. |

## Public constructors

### ArcMotion

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

```
public ArcMotion()
```

### ArcMotion

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

```
public ArcMotion(@NonNull Context context, @NonNull AttributeSet attrs)
```

## Public methods

### getMaximumAngle

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

```
public float getMaximumAngle()
```

Returns the maximum arc along the circle between two points. When start and end points have close to equal x and y differences, the curve between them is large. This forces the curved path to have an arc of at most the given angle.

The default value is 70 degrees.

| Returns |
|---|---|
| `float` | The maximum angle of the arc on a circle describing the Path between the start and end points. |

### getMinimumHorizontalAngle

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

```
public float getMinimumHorizontalAngle()
```

Returns the minimum arc along the circle between two points aligned near horizontally. When start and end points are close to horizontal, the calculated center point of the circle will be far from both points, giving a near straight path between the points. By setting a minimum angle, this forces the center point to be closer and give an exaggerated curve to the path.

The default value is 0.

| Returns |
|---|---|
| `float` | The minimum arc along the circle between two points aligned near horizontally. |

### getMinimumVerticalAngle

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

```
public float getMinimumVerticalAngle()
```

Returns the minimum arc along the circle between two points aligned near vertically. When start and end points are close to vertical, the calculated center point of the circle will be far from both points, giving a near straight path between the points. By setting a minimum angle, this forces the center point to be closer and give an exaggerated curve to the path.

The default value is 0.

| Returns |
|---|---|
| `float` | The minimum angle of the arc on a circle describing the Path between two nearly vertically-separated points. |

### getPath

```
public @NonNull Path getPath(float startX, float startY, float endX, float endY)
```

Provide a Path to interpolate between two points `(startX, startY)` and `(endX, endY)`. This allows controlled curved motion along two dimensions.

| Parameters |
|---|---|
| `float startX` | The x coordinate of the starting point. |
| `float startY` | The y coordinate of the starting point. |
| `float endX` | The x coordinate of the ending point. |
| `float endY` | The y coordinate of the ending point. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Path.html` | A Path along which the points should be interpolated. The returned Path must start at point `(startX, startY)`, typically using `https://developer.android.com/reference/android/graphics/Path.html#moveTo(float, float)` and end at `(endX, endY)`. |

### setMaximumAngle

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

```
public void setMaximumAngle(float angleInDegrees)
```

Sets the maximum arc along the circle between two points. When start and end points have close to equal x and y differences, the curve between them is large. This forces the curved path to have an arc of at most the given angle.

The default value is 70 degrees.

| Parameters |
|---|---|
| `float angleInDegrees` | The maximum angle of the arc on a circle describing the Path between the start and end points. |

### setMinimumHorizontalAngle

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

```
public void setMinimumHorizontalAngle(float angleInDegrees)
```

Sets the minimum arc along the circle between two points aligned near horizontally. When start and end points are close to horizontal, the calculated center point of the circle will be far from both points, giving a near straight path between the points. By setting a minimum angle, this forces the center point to be closer and give an exaggerated curve to the path.

The default value is 0.

| Parameters |
|---|---|
| `float angleInDegrees` | The minimum angle of the arc on a circle describing the Path between two nearly horizontally-separated points. |

### setMinimumVerticalAngle

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

```
public void setMinimumVerticalAngle(float angleInDegrees)
```

Sets the minimum arc along the circle between two points aligned near vertically. When start and end points are close to vertical, the calculated center point of the circle will be far from both points, giving a near straight path between the points. By setting a minimum angle, this forces the center point to be closer and give an exaggerated curve to the path.

The default value is 0.

| Parameters |
|---|---|
| `float angleInDegrees` | The minimum angle of the arc on a circle describing the Path between two nearly vertically-separated points. |