# Key

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/Key.java+class:androidx.constraintlayout.motion.widget.Key) Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

*** ** * ** ***


```
abstract class Key
```

<br />

Known direct subclasses [KeyAttributes](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyAttributes), [KeyCycle](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyCycle), [KeyPosition](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition), [KeyTimeCycle](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyTimeCycle), [KeyTrigger](https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyTrigger)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyAttributes` | Defines container for a key frame of for storing KeyAttributes. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyCycle` | Provide the passive data structure to get KeyPosition information form XML |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyPosition` | Provide the passive data structure to get KeyPosition information form XML |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyTimeCycle` | Defines container for a key frame of for storing KeyTimeCycles. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/KeyTrigger` | Defines container for a key frame of for storing KeyAttributes. |

*** ** * ** ***

Base class in an element in a KeyFrame

## Summary

| ### Constants |
|---|---|
| `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"` |

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

| ### Public functions |
|---|---|
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#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. |
| `abstract https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#clone()()` Return a copy of this |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#copy(androidx.constraintlayout.motion.widget.Key)(src: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key!)` Return a copy of this 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 |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#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 |
| `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 |

| ### Public properties |
|---|---|
| `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()` |

| ### Protected properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/Key#mType()` |

## Constants

### ALPHA

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

```
const val ALPHA = "alpha": String!
```

### CURVEFIT

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

```
const val CURVEFIT = "curveFit": String!
```

### CUSTOM

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

```
const val CUSTOM = "CUSTOM": String!
```

### ELEVATION

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

```
const val ELEVATION = "elevation": String!
```

### MOTIONPROGRESS

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

```
const val MOTIONPROGRESS = "motionProgress": String!
```

### PIVOT_X

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

```
const val PIVOT_X = "transformPivotX": String!
```

### PIVOT_Y

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

```
const val PIVOT_Y = "transformPivotY": String!
```

### PROGRESS

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

```
const val PROGRESS = "progress": String!
```

### ROTATION

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

```
const val ROTATION = "rotation": String!
```

### ROTATION_X

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

```
const val ROTATION_X = "rotationX": String!
```

### ROTATION_Y

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

```
const val ROTATION_Y = "rotationY": String!
```

### SCALE_X

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

```
const val SCALE_X = "scaleX": String!
```

### SCALE_Y

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

```
const val SCALE_Y = "scaleY": String!
```

### TRANSITIONEASING

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

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

### TRANSITION_PATH_ROTATE

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

```
const val TRANSITION_PATH_ROTATE = "transitionPathRotate": String!
```

### TRANSLATION_X

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

```
const val TRANSLATION_X = "translationX": String!
```

### TRANSLATION_Y

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

```
const val TRANSLATION_Y = "translationY": String!
```

### TRANSLATION_Z

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

```
const val TRANSLATION_Z = "translationZ": String!
```

### VISIBILITY

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

```
const val VISIBILITY = "visibility": String!
```

### WAVE_OFFSET

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

```
const val WAVE_OFFSET = "waveOffset": String!
```

### WAVE_PERIOD

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

```
const val WAVE_PERIOD = "wavePeriod": String!
```

### WAVE_PHASE

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

```
const val WAVE_PHASE = "wavePhase": String!
```

### WAVE_VARIES_BY

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

```
const val WAVE_VARIES_BY = "waveVariesBy": String!
```

## Public constructors

### Key

Added in 2.2.2

```
Key()
```

## Public functions

### addValues

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

```
abstract 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)

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

Return a copy of this

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

### copy

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

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

Return a copy of this key

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

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

### getFramePosition

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

```
fun getFramePosition(): Int
```

Gets the current frame position

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

### setFramePosition

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

```
fun setFramePosition(pos: Int): Unit
```

sets the frame position

| Parameters |
|---|---|
| `pos: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |

### setInterpolation

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

```
fun setInterpolation(interpolation: HashMap<String!, Int!>!): Unit
```

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

| Parameters |
|---|---|
| `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!>!` |   |

### setValue

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

```
abstract 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!` |   |

### setViewId

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

```
fun setViewId(id: Int): Key!
```

set the id of the view

| Parameters |
|---|---|
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |

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

## Public properties

### UNSET

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

```
java-static val UNSET: Int
```

## Protected properties

### mType

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

```
protected val mType: Int
```