ArcMotion


class ArcMotion : PathMotion


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 and setMinimumVerticalAngle 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

ArcMotion(context: Context, attrs: AttributeSet)

Public functions

Float

Returns the maximum arc along the circle between two points.

Float

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

Float

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

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

Provide a Path to interpolate between two points (startX, startY) and (endX, endY).

Unit
setMaximumAngle(angleInDegrees: Float)

Sets the maximum arc along the circle between two points.

Unit

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

Unit
setMinimumVerticalAngle(angleInDegrees: Float)

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

Public constructors

ArcMotion

Added in 1.0.0
ArcMotion()

ArcMotion

Added in 1.0.0
ArcMotion(context: Context, attrs: AttributeSet)

Public functions

getMaximumAngle

Added in 1.0.0
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.

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
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.

Returns
Float

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

getMinimumVerticalAngle

Added in 1.0.0
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.

Returns
Float

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

getPath

Added in 1.6.0-alpha01
fun getPath(startX: Float, startY: Float, endX: Float, endY: Float): Path

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

Parameters
startX: Float

The x coordinate of the starting point.

startY: Float

The y coordinate of the starting point.

endX: Float

The x coordinate of the ending point.

endY: Float

The y coordinate of the ending point.

Returns
Path

A Path along which the points should be interpolated. The returned Path must start at point (startX, startY), typically using moveTo and end at (endX, endY).

setMaximumAngle

Added in 1.0.0
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

Added in 1.0.0
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

Added in 1.0.0
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.