# KeyTimeCycle

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

*** ** * ** ***


```
public class KeyTimeCycle 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.KeyTimeCycle](https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyTimeCycle) |

*** ** * ** ***

Defines container for a key frame of for storing KeyTimeCycles. KeyTimeCycles change post layout values of a view.

## Summary

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

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

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyTimeCycle#addTimeValues(java.util.HashMap<java.lang.String,androidx.constraintlayout.motion.utils.ViewTimeCycle>)(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/ViewTimeCycle> splines)` Add values to TimeCycle Map |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyTimeCycle#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/KeyTimeCycle#clone()()` Clone this KeyAttributes |
| `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/Key` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyTimeCycle#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/KeyTimeCycle#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)` Gets the curve fit type this drives the interpolation |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyTimeCycle#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)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyTimeCycle#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)` put key and position into the interpolation map |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/motion/widget/KeyTimeCycle#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 | | `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 = 3
```

### 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_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

### KeyTimeCycle

Added in 2.2.2

```
public KeyTimeCycle()
```

## Public methods

### addTimeValues

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

```
public void addTimeValues(HashMap<String, ViewTimeCycle> splines)
```

Add values to TimeCycle Map

| 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/ViewTimeCycle> splines` |   |

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

Gets the curve fit type this drives the interpolation

### load

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

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

### setInterpolation

```
public void setInterpolation(HashMap<String, Integer> interpolation)
```

put key and position into the interpolation map

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

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