Stay organized with collections
Save and categorize content based on your preferences.
PathMotion
abstract class PathMotion
Known Direct Subclasses
ArcMotion |
A PathMotion that generates a curved path along an arc on an imaginary circle containing the two points.
|
PatternPathMotion |
A PathMotion that takes a Path pattern and applies it to the separation between two points.
|
|
This base class can be extended to provide motion along a Path to Transitions.
Transitions such as android.transition.ChangeBounds
move Views, typically in a straight path between the start and end positions. Applications that desire to have these motions move in a curve can change how Views interpolate in two dimensions by extending PathMotion and implementing getPath(float,float,float,float)
.
This may be used in XML as an element inside a transition.
<code><changeBounds>
<pathMotion class="my.app.transition.MyPathMotion"/>
</changeBounds>
</code>
Summary
Public methods |
abstract Path! |
Provide a Path to interpolate between two points (startX, startY) and (endX, endY) .
|
Public constructors
Public methods
getPath
abstract 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. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# PathMotion\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPathMotion\n==========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/transition/PathMotion \"View this page in Java\") \n\n```\nabstract class PathMotion\n```\n\n|---|------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.transition.PathMotion](#) |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [ArcMotion](/reference/kotlin/android/transition/ArcMotion), [PatternPathMotion](/reference/kotlin/android/transition/PatternPathMotion) |-----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------| | [ArcMotion](/reference/kotlin/android/transition/ArcMotion) | A PathMotion that generates a curved path along an arc on an imaginary circle containing the two points. | | [PatternPathMotion](/reference/kotlin/android/transition/PatternPathMotion) | A PathMotion that takes a Path pattern and applies it to the separation between two points. | |\n\nThis base class can be extended to provide motion along a Path to Transitions.\n\nTransitions such as [android.transition.ChangeBounds](/reference/kotlin/android/transition/ChangeBounds) move Views, typically in a straight path between the start and end positions. Applications that desire to have these motions move in a curve can change how Views interpolate in two dimensions by extending PathMotion and implementing [getPath(float,float,float,float)](#getPath(kotlin.Float,%20kotlin.Float,%20kotlin.Float,%20kotlin.Float)).\n\nThis may be used in XML as an element inside a transition. \n\n```kotlin\n\u003ccode\u003e<changeBounds>\n <pathMotion class=\"my.app.transition.MyPathMotion\"/>\n </changeBounds>\n \u003c/code\u003e\n```\n\nSummary\n-------\n\n| Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [PathMotion](#PathMotion())`()` \u003cbr /\u003e |\n| [PathMotion](#PathMotion(android.content.Context,%20android.util.AttributeSet))`(`context:` `[Context](../content/Context.html#)!`, `attrs:` `[AttributeSet](../util/AttributeSet.html#)!`)` \u003cbr /\u003e |\n\n| Public methods ||\n|------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Path](../graphics/Path.html#)! | [getPath](#getPath(kotlin.Float,%20kotlin.Float,%20kotlin.Float,%20kotlin.Float))`(`startX:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `startY:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `endX:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `endY:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Provide a Path to interpolate between two points `(startX, startY)` and `(endX, endY)`. |\n\nPublic constructors\n-------------------\n\n### PathMotion\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nPathMotion()\n``` \n\n### PathMotion\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nPathMotion(\n context: Context!, \n attrs: AttributeSet!)\n```\n\nPublic methods\n--------------\n\n### getPath\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getPath(\n startX: Float, \n startY: Float, \n endX: Float, \n endY: Float\n): Path!\n```\n\nProvide a Path to interpolate between two points `(startX, startY)` and `(endX, endY)`. This allows controlled curved motion along two dimensions.\n\n| Parameters ||\n|----------|-------------------------------------------------------------------------------------------------------------------------|\n| `startX` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html): The x coordinate of the starting point. |\n| `startY` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html): The y coordinate of the starting point. |\n| `endX` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html): The x coordinate of the ending point. |\n| `endY` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html): The y coordinate of the ending point. |\n\n| Return ||\n|---------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Path](../graphics/Path.html#)! | A Path along which the points should be interpolated. The returned Path must start at point `(startX, startY)`, typically using [android.graphics.Path#moveTo(float, float)](../graphics/Path.html#moveTo(kotlin.Float,%20kotlin.Float)) and end at `(endX, endY)`. |"]]