# KeyPosition

Artifact: [androidx.constraintlayout:constraintlayout](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/motion/widget/KeyPosition.java+class:androidx.constraintlayout.motion.widget.KeyPosition) Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

*** ** * ** ***

<br />

```
class KeyPosition : Key
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.constraintlayout.motion.widget.Key](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key) ||
|   | ↳ | [androidx.constraintlayout.motion.widget.KeyPosition](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition) |

*** ** * ** ***

Provide the passive data structure to get KeyPosition information form XML

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#DRAWPATH() = "drawPath"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#PERCENT_HEIGHT() = "percentHeight"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#PERCENT_WIDTH() = "percentWidth"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#PERCENT_X() = "percentX"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#PERCENT_Y() = "percentY"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#SELECTION_SLOPE() = 20.0f` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#SIZE_PERCENT() = "sizePercent"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#TRANSITION_EASING() = "transitionEasing"` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#TYPE_AXIS() = 3` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#TYPE_CARTESIAN() = 0` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#TYPE_PATH() = 1` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#TYPE_SCREEN() = 2` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#KeyPosition()()` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#addValues(java.util.HashMap<java.lang.String,androidx.constraintlayout.motion.utils.ViewSpline>)(splines: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/utils/ViewSpline!>!)` Defines method to add a a view to splines derived form this key frame. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#clone()()` Clone this KeyAttributes |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#copy(androidx.constraintlayout.motion.widget.Key)(src: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!)` Copy the key |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#intersects(int,int,android.graphics.RectF,android.graphics.RectF,float,float)( layoutWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, layoutHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, start: https://developer.android.com/reference/android/graphics/RectF.html!, end: https://developer.android.com/reference/android/graphics/RectF.html!, x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#load(android.content.Context,android.util.AttributeSet)(context: https://developer.android.com/reference/android/content/Context.html!, attrs: https://developer.android.com/reference/android/util/AttributeSet.html!)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#positionAttributes(android.view.View,android.graphics.RectF,android.graphics.RectF,float,float,java.lang.String[],float[])( view: https://developer.android.com/reference/android/view/View.html!, start: https://developer.android.com/reference/android/graphics/RectF.html!, end: https://developer.android.com/reference/android/graphics/RectF.html!, x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, attribute: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>! )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#setType(int)(type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition#setValue(java.lang.String,java.lang.Object)(tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` Set the value associated with this tag |

### Inherited Constants

From [androidx.constraintlayout.motion.widget.Key](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#ALPHA() = "alpha"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#CURVEFIT() = "curveFit"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#CUSTOM() = "CUSTOM"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#ELEVATION() = "elevation"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#MOTIONPROGRESS() = "motionProgress"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#PIVOT_X() = "transformPivotX"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#PIVOT_Y() = "transformPivotY"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#PROGRESS() = "progress"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#ROTATION() = "rotation"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#ROTATION_X() = "rotationX"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#ROTATION_Y() = "rotationY"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#SCALE_X() = "scaleX"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#SCALE_Y() = "scaleY"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#TRANSITIONEASING() = "transitionEasing"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#TRANSITION_PATH_ROTATE() = "transitionPathRotate"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#TRANSLATION_X() = "translationX"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#TRANSLATION_Y() = "translationY"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#TRANSLATION_Z() = "translationZ"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#VISIBILITY() = "visibility"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#WAVE_OFFSET() = "waveOffset"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#WAVE_PERIOD() = "wavePeriod"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#WAVE_PHASE() = "wavePhase"` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#WAVE_VARIES_BY() = "waveVariesBy"`

### Inherited functions

From [androidx.constraintlayout.motion.widget.Key](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#getFramePosition()()`

Gets the current frame position
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#setFramePosition(int)(pos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

sets the frame position
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#setInterpolation(java.util.HashMap<java.lang.String,java.lang.Integer>)(interpolation: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>!)`

Key frame can specify the type of interpolation it wants on various attributes For each string it set it to -1, CurveFit.LINEAR or CurveFit.SPLINE
`https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#setViewId(int)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

set the id of the view

### Inherited properties

From [androidx.constraintlayout.motion.widget.Key](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key) `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#UNSET()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#mType()`

## Constants

### DRAWPATH

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

```
const val DRAWPATH = "drawPath": String!
```

### PERCENT_HEIGHT

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

```
const val PERCENT_HEIGHT = "percentHeight": String!
```

### PERCENT_WIDTH

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

```
const val PERCENT_WIDTH = "percentWidth": String!
```

### PERCENT_X

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

```
const val PERCENT_X = "percentX": String!
```

### PERCENT_Y

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

```
const val PERCENT_Y = "percentY": String!
```

### SELECTION_SLOPE

```
protected const val SELECTION_SLOPE = 20.0f: Float
```

### SIZE_PERCENT

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

```
const val SIZE_PERCENT = "sizePercent": String!
```

### TRANSITION_EASING

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

```
const val TRANSITION_EASING = "transitionEasing": String!
```

### TYPE_AXIS

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

```
const val TYPE_AXIS = 3: Int
```

### TYPE_CARTESIAN

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

```
const val TYPE_CARTESIAN = 0: Int
```

### TYPE_PATH

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

```
const val TYPE_PATH = 1: Int
```

### TYPE_SCREEN

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

```
const val TYPE_SCREEN = 2: Int
```

## Public constructors

### KeyPosition

Added in 2.2.2

```
KeyPosition()
```

## Public functions

### addValues

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

```
fun addValues(splines: HashMap<String!, ViewSpline!>!): Unit
```

Defines method to add a a view to splines derived form this key frame. The values are written to the spline

| Parameters |
|---|---|
| `splines: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/utils/ViewSpline!>!` | splines to write values to |

### clone

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

```
fun clone(): Key!
```

Clone this KeyAttributes

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!` |   |

### copy

```
fun copy(src: Key!): Key!
```

Copy the key

| Parameters |
|---|---|
| `src: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!` | to be copied |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!` | self |

### intersects

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

```
fun intersects(
    layoutWidth: Int,
    layoutHeight: Int,
    start: RectF!,
    end: RectF!,
    x: Float,
    y: Float
): Boolean
```

| Parameters |
|---|---|
| `layoutWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |
| `layoutHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |
| `start: https://developer.android.com/reference/android/graphics/RectF.html!` |   |
| `end: https://developer.android.com/reference/android/graphics/RectF.html!` |   |
| `x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` |   |
| `y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` |   |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` |   |

### load

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

```
fun load(context: Context!, attrs: AttributeSet!): Unit
```

### positionAttributes

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

```
fun positionAttributes(
    view: View!,
    start: RectF!,
    end: RectF!,
    x: Float,
    y: Float,
    attribute: Array<String!>!,
    value: FloatArray<Float>!
): Unit
```

| Parameters |
|---|---|
| `view: https://developer.android.com/reference/android/view/View.html!` |   |
| `start: https://developer.android.com/reference/android/graphics/RectF.html!` |   |
| `end: https://developer.android.com/reference/android/graphics/RectF.html!` |   |
| `x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` |   |
| `y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` |   |
| `attribute: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` |   |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` |   |

### setType

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

```
fun setType(type: Int): Unit
```

### setValue

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

```
fun setValue(tag: String!, value: Any!): Unit
```

Set the value associated with this tag

| Parameters |
|---|---|
| `tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` |   |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` |   |