# PatternPathMotion

# PatternPathMotion

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/transition/PatternPathMotion "View this page in Java")

<br />

```
class PatternPathMotion : PathMotion
```

<br />

|---|---|-------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                  |||
| ↳ | [androidx.transition.PathMotion](https://developer.android.com/reference/kotlin/androidx/transition/PathMotion)                  ||
|   | ↳ | [androidx.transition.PatternPathMotion](https://developer.android.com/reference/kotlin/androidx/transition/PatternPathMotion) |

*** ** * ** ***

A PathMotion that takes a Path pattern and applies it to the separation between two points. The starting point of the Path will be moved to the origin and the end point will be scaled and rotated so that it matches with the target end point.

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

```kotlin
<changeBounds>
    <patternPathMotion android:patternPathData="M0 0 L0 100 L100 100"/>
</changeBounds>
```

## Summary

|                                                                                                                                                                            ### Public constructors                                                                                                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PatternPathMotion](https://developer.android.com/reference/kotlin/androidx/transition/PatternPathMotion#PatternPathMotion())`()` Constructs a PatternPathMotion with a straight-line pattern.                                                                                                                                                                                |
| [PatternPathMotion](https://developer.android.com/reference/kotlin/androidx/transition/PatternPathMotion#PatternPathMotion(android.graphics.Path))`(patternPath: `[Path](https://developer.android.com/reference/android/graphics/Path.html)`)` Creates a PatternPathMotion with the Path defining a pattern of motion between two coordinates.                               |
| [PatternPathMotion](https://developer.android.com/reference/kotlin/androidx/transition/PatternPathMotion#PatternPathMotion(android.content.Context,android.util.AttributeSet))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`, attrs: `[AttributeSet](https://developer.android.com/reference/android/util/AttributeSet.html)`)` |

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Path](https://developer.android.com/reference/android/graphics/Path.html)    | [getPath](https://developer.android.com/reference/kotlin/androidx/transition/PatternPathMotion#getPath(float,float,float,float))`(startX: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, startY: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, endX: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, endY: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Provide a Path to interpolate between two points`(startX, startY)`and`(endX, endY)`. |
| [Path](https://developer.android.com/reference/android/graphics/Path.html)    | [getPatternPath](https://developer.android.com/reference/kotlin/androidx/transition/PatternPathMotion#getPatternPath())`()` Returns the Path defining a pattern of motion between two coordinates.                                                                                                                                                                                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setPatternPath](https://developer.android.com/reference/kotlin/androidx/transition/PatternPathMotion#setPatternPath(android.graphics.Path))`(patternPath: `[Path](https://developer.android.com/reference/android/graphics/Path.html)`)` Sets the Path defining a pattern of motion between two coordinates.                                                                                                                                                                                                                                                                                   |

## Public constructors

### PatternPathMotion

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

```
PatternPathMotion()
```

Constructs a PatternPathMotion with a straight-line pattern.  

### PatternPathMotion

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

```
PatternPathMotion(patternPath: Path)
```

Creates a PatternPathMotion with the Path defining a pattern of motion between two coordinates. The pattern will be translated, rotated, and scaled to fit between the start and end points. The pattern must not be empty and must have the end point differ from the start point.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|------------------------------------------------------------|
| `patternPath: `[Path](https://developer.android.com/reference/android/graphics/Path.html) | A Path to be used as a pattern for two-dimensional motion. |

### PatternPathMotion

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

```
PatternPathMotion(context: Context, attrs: AttributeSet)
```  

## Public functions

### getPath

```
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](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The x coordinate of the starting point. |
| `startY: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The y coordinate of the starting point. |
| `endX: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)   | The x coordinate of the ending point.   |
| `endY: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)   | The y coordinate of the ending point.   |

|                                  Returns                                   |
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Path](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[moveTo](https://developer.android.com/reference/android/graphics/Path.html#moveTo(float, float))and end at`(endX, endY)`. |

### getPatternPath

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

```
fun getPatternPath(): Path
```

Returns the Path defining a pattern of motion between two coordinates. The pattern will be translated, rotated, and scaled to fit between the start and end points. The pattern must not be empty and must have the end point differ from the start point.  

|                                  Returns                                   |
|----------------------------------------------------------------------------|----------------------------------------------------------------|
| [Path](https://developer.android.com/reference/android/graphics/Path.html) | the Path defining a pattern of motion between two coordinates. |

### setPatternPath

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

```
fun setPatternPath(patternPath: Path): Unit
```

Sets the Path defining a pattern of motion between two coordinates. The pattern will be translated, rotated, and scaled to fit between the start and end points. The pattern must not be empty and must have the end point differ from the start point.  

|                                        Parameters                                         |
|-------------------------------------------------------------------------------------------|------------------------------------------------------------|
| `patternPath: `[Path](https://developer.android.com/reference/android/graphics/Path.html) | A Path to be used as a pattern for two-dimensional motion. |