Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

ArcMotion

open class ArcMotion : PathMotion
kotlin.Any
   ↳ androidx.transition.PathMotion
   ↳ 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, setMinimumHorizontalAngle(float) and 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.

<code>&lt;changeBounds&gt;
    &lt;arcMotion android:minimumHorizontalAngle="15"
               android:minimumVerticalAngle="0"
               android:maximumAngle="90"/&gt;
  &lt;/changeBounds&gt;</code>

Summary

Public constructors

<init>(context: Context!, attrs: AttributeSet!)

Public methods

open Float

Returns the maximum arc along the circle between two points.

open Float

Returns the minimum arc along the circle between two points aligned near horizontally.

open Float

Returns the minimum arc along the circle between two points aligned near vertically.

open Path!
getPath(startX: Float, startY: Float, endX: Float, endY: Float)

open Unit
setMaximumAngle(angleInDegrees: Float)

Sets the maximum arc along the circle between two points.

open Unit

Sets the minimum arc along the circle between two points aligned near horizontally.

open Unit
setMinimumVerticalAngle(angleInDegrees: Float)

Sets the minimum arc along the circle between two points aligned near vertically.

Public constructors

<init>

ArcMotion()

<init>

ArcMotion(context: Context!, attrs: AttributeSet!)

Public methods

getMaximumAngle

open fun getMaximumAngle(): Float

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.

Return
Float: The maximum angle of the arc on a circle describing the Path between the start and end points.

getMinimumHorizontalAngle

open fun getMinimumHorizontalAngle(): Float

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.

Return
Float: The minimum arc along the circle between two points aligned near horizontally.

getMinimumVerticalAngle

open fun getMinimumVerticalAngle(): Float

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.

Return
Float: The minimum angle of the arc on a circle describing the Path between two nearly vertically-separated points.

getPath

open fun getPath(startX: Float, startY: Float, endX: Float, endY: Float): Path!

setMaximumAngle

open fun setMaximumAngle(angleInDegrees: Float): Unit

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
angleInDegrees Float: The maximum angle of the arc on a circle describing the Path between the start and end points.

setMinimumHorizontalAngle

open fun setMinimumHorizontalAngle(angleInDegrees: Float): Unit

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
angleInDegrees Float: The minimum angle of the arc on a circle describing the Path between two nearly horizontally-separated points.

setMinimumVerticalAngle

open fun setMinimumVerticalAngle(angleInDegrees: Float): Unit

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
angleInDegrees Float: The minimum angle of the arc on a circle describing the Path between two nearly vertically-separated points.