# KeyCycle

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

*** ** * ** ***


```
public class KeyCycle extends Key
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.constraintlayout.motion.widget.Key](https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key) ||
|   | ↳ | [androidx.constraintlayout.motion.widget.KeyCycle](https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle) |

*** ** * ** ***

Provide the passive data structure to get KeyPosition information form XML

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#KEY_TYPE() = 4` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#SHAPE_BOUNCE() = 6` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#SHAPE_COS_WAVE() = 5` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#SHAPE_REVERSE_SAW_WAVE() = 4` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#SHAPE_SAW_WAVE() = 3` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#SHAPE_SIN_WAVE() = 0` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#SHAPE_SQUARE_WAVE() = 1` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#SHAPE_TRIANGLE_WAVE() = 2` |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#WAVE_OFFSET() = "waveOffset"` |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#WAVE_PERIOD() = "wavePeriod"` |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#WAVE_PHASE() = "wavePhase"` |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#WAVE_SHAPE() = "waveShape"` |

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

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#addCycleValues(java.util.HashMap<java.lang.String,androidx.constraintlayout.motion.utils.ViewOscillator>)(https://developer.android.com/reference/java/util/HashMap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/androidx/constraintlayout/motion/utils/ViewOscillator> oscSet)` Add this key cycle to the keyCycle engines |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#addValues(java.util.HashMap<java.lang.String,androidx.constraintlayout.motion.utils.ViewSpline>)(https://developer.android.com/reference/java/util/HashMap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/androidx/constraintlayout/motion/utils/ViewSpline> splines)` Defines method to add a a view to splines derived form this key frame. |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#clone()()` Clone this KeyAttributes |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#copy(androidx.constraintlayout.motion.widget.Key)(https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key src)` Copy the key |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#getAttributeNames(java.util.HashSet<java.lang.String>)(https://developer.android.com/reference/java/util/HashSet.html<https://developer.android.com/reference/java/lang/String.html> attributes)` |
| `float` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#getValue(java.lang.String)(https://developer.android.com/reference/java/lang/String.html key)` get the value for a given attribute of the keyCycel |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#load(android.content.Context,android.util.AttributeSet)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/util/AttributeSet.html attrs)` Load the KeyCycle from xml attributes |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyCycle#setValue(java.lang.String,java.lang.Object)(https://developer.android.com/reference/java/lang/String.html tag, https://developer.android.com/reference/java/lang/Object.html value)` Set the value associated with this tag |

| ### Inherited Constants |
|---|
| From [androidx.constraintlayout.motion.widget.Key](https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key) |---|---| | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#ALPHA() = "alpha"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#CURVEFIT() = "curveFit"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#CUSTOM() = "CUSTOM"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#ELEVATION() = "elevation"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#MOTIONPROGRESS() = "motionProgress"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#PIVOT_X() = "transformPivotX"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#PIVOT_Y() = "transformPivotY"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#PROGRESS() = "progress"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#ROTATION() = "rotation"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#ROTATION_X() = "rotationX"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#ROTATION_Y() = "rotationY"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#SCALE_X() = "scaleX"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#SCALE_Y() = "scaleY"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#TRANSITIONEASING() = "transitionEasing"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#TRANSITION_PATH_ROTATE() = "transitionPathRotate"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#TRANSLATION_X() = "translationX"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#TRANSLATION_Y() = "translationY"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#TRANSLATION_Z() = "translationZ"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#VISIBILITY() = "visibility"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#WAVE_OFFSET() = "waveOffset"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#WAVE_PERIOD() = "wavePeriod"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#WAVE_PHASE() = "wavePhase"` | | `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#WAVE_VARIES_BY() = "waveVariesBy"` | |

| ### Inherited fields |
|---|
| From [androidx.constraintlayout.motion.widget.Key](https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key) |---|---| | `static int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#UNSET()` | | `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#mType()` | |

| ### Inherited methods |
|---|
| From [androidx.constraintlayout.motion.widget.Key](https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key) |---|---| | `int` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#getFramePosition()()` Gets the current frame position | | `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#setFramePosition(int)(int pos)` sets the frame position | | `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#setInterpolation(java.util.HashMap<java.lang.String,java.lang.Integer>)(https://developer.android.com/reference/java/util/HashMap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/Integer.html> interpolation)` 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/androidx/constraintlayout/motion/widget/Key` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key#setViewId(int)(int id)` set the id of the view | |

## Constants

### KEY_TYPE

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

```
public static final int KEY_TYPE = 4
```

### SHAPE_BOUNCE

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

```
public static final int SHAPE_BOUNCE = 6
```

### SHAPE_COS_WAVE

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

```
public static final int SHAPE_COS_WAVE = 5
```

### SHAPE_REVERSE_SAW_WAVE

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

```
public static final int SHAPE_REVERSE_SAW_WAVE = 4
```

### SHAPE_SAW_WAVE

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

```
public static final int SHAPE_SAW_WAVE = 3
```

### SHAPE_SIN_WAVE

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

```
public static final int SHAPE_SIN_WAVE = 0
```

### SHAPE_SQUARE_WAVE

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

```
public static final int SHAPE_SQUARE_WAVE = 1
```

### SHAPE_TRIANGLE_WAVE

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

```
public static final int SHAPE_TRIANGLE_WAVE = 2
```

### WAVE_OFFSET

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

```
public static final String WAVE_OFFSET = "waveOffset"
```

### WAVE_PERIOD

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

```
public static final String WAVE_PERIOD = "wavePeriod"
```

### WAVE_PHASE

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

```
public static final String WAVE_PHASE = "wavePhase"
```

### WAVE_SHAPE

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

```
public static final String WAVE_SHAPE = "waveShape"
```

## Public constructors

### KeyCycle

Added in 2.2.2

```
public KeyCycle()
```

## Public methods

### addCycleValues

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

```
public void addCycleValues(HashMap<String, ViewOscillator> oscSet)
```

Add this key cycle to the keyCycle engines

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/HashMap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/androidx/constraintlayout/motion/utils/ViewOscillator> oscSet` |   |

### addValues

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

```
public void addValues(HashMap<String, ViewSpline> splines)
```

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/HashMap.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/androidx/constraintlayout/motion/utils/ViewSpline> splines` | splines to write values to |

### clone

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

```
public Key clone()
```

Clone this KeyAttributes

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

### copy

```
public Key copy(Key src)
```

Copy the key

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

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

### getAttributeNames

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

```
public void getAttributeNames(HashSet<String> attributes)
```

### getValue

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

```
public float getValue(String key)
```

get the value for a given attribute of the keyCycel

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html key` |   |

| Returns |
|---|---|
| `float` |   |

### load

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

```
public void load(Context context, AttributeSet attrs)
```

Load the KeyCycle from xml attributes

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` |   |
| `https://developer.android.com/reference/android/util/AttributeSet.html attrs` |   |

### setValue

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

```
public void setValue(String tag, Object value)
```

Set the value associated with this tag

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html tag` |   |
| `https://developer.android.com/reference/java/lang/Object.html value` |   |