# MotionScene

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

*** ** * ** ***

<br />

```
class MotionScene
```

<br />

*** ** * ** ***

The information to transition between multiple ConstraintSets This Class is meant to be used from XML

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition` Transition defines the interaction from one state to another. |
| `class https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition.TransitionOnClick : https://developer.android.com/reference/android/view/View.OnClickListener.html` |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#LAYOUT_CALL_MEASURE() = 2` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#LAYOUT_HONOR_REQUEST() = 1` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#LAYOUT_IGNORE_REQUEST() = 0` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#UNSET() = -1` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#MotionScene(androidx.constraintlayout.motion.widget.MotionLayout)(layout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!)` Create a motion scene. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#addOnClickListeners(androidx.constraintlayout.motion.widget.MotionLayout,int)(motionLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!, currentState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Add all on click listeners for the current state |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#addTransition(androidx.constraintlayout.motion.widget.MotionScene.Transition)(transition: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!)` Add a transition to the motion scene. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#applyViewTransition(int,androidx.constraintlayout.motion.widget.MotionController)( viewTransitionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, motionController: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionController! )` Apply a view transition to the MotionController |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#bestTransitionFor(int,float,float,android.view.MotionEvent)( currentState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, dx: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, dy: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, lastTouchDown: https://developer.android.com/reference/android/view/MotionEvent.html! )` Find the best transition for the motion |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#disableAutoTransition(boolean)(disable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` this allow disabling autoTransitions to prevent design surface from being in undefined states |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#enableViewTransition(int,boolean)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, enable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Enable this viewTransition |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#gatPathMotionArc()()` The transition arc path mode |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintSet!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getConstraintSet(android.content.Context,java.lang.String)(context: https://developer.android.com/reference/android/content/Context.html!, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Get the constraintSet given the id |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getConstraintSetIds()()` Get the list of all Constraint Sets Know to the system |
| `https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!>!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getDefinedTransitions()()` Get list of Transitions know to the system |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getDuration()()` Get Duration of the current transition. |
| `https://developer.android.com/reference/android/view/animation/Interpolator.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getInterpolator()()` Get the interpolator define for the current Transition |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getKeyFrames(androidx.constraintlayout.motion.widget.MotionController)(motionController: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionController!)` provides the key frames \&CycleFrames to the motion view to |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getMatchingStateLabels(java.lang.String...)(types: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!)` Get the id's of all constraintSets with the matching types |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getPathPercent(android.view.View,int)(view: https://developer.android.com/reference/android/view/View.html!, position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Get the path percent (Non functional currently) |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getStaggered()()` Get the staggered value of the current transition. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getTransitionById(int)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Find the transition based on the id |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!>!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#getTransitionsWithState(int)(stateId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Get all transitions that include this state |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#isViewTransitionEnabled(int)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Is this view transition enabled |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#lookUpConstraintId(java.lang.String)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Used at design time |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#lookUpConstraintName(int)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` used at design time |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#removeTransition(androidx.constraintlayout.motion.widget.MotionScene.Transition)(transition: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!)` Remove the transition with the matching id from the motion scene. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#setConstraintSet(int,androidx.constraintlayout.widget.ConstraintSet)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, set: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintSet!)` Maps the Constraint set to the id. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#setDuration(int)(duration: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the duration of the current transition or the default if there is no current transition |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#setKeyframe(android.view.View,int,java.lang.String,java.lang.Object)(view: https://developer.android.com/reference/android/view/View.html!, position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` Set a keyFrame on the current Transition |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#setRtl(boolean)(rtl: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Set Right to left |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#setTransition(androidx.constraintlayout.motion.widget.MotionScene.Transition)(transition: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!)` Set the transition to be the current transition of the motion scene. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#stripID(java.lang.String)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Utility to strip the @id/ from an id |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#validateLayout(androidx.constraintlayout.motion.widget.MotionLayout)(layout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#viewTransition(int,android.view.View...)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, view: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/android/view/View.html!>!)` Apply the viewTransition on the list of views |

| ### Protected functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#onLayout(boolean,int,int,int,int)(changed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, left: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, top: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, right: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, bottom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

## Constants

### LAYOUT_CALL_MEASURE

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

```
const val LAYOUT_CALL_MEASURE = 2: Int
```

### LAYOUT_HONOR_REQUEST

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

```
const val LAYOUT_HONOR_REQUEST = 1: Int
```

### LAYOUT_IGNORE_REQUEST

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

```
const val LAYOUT_IGNORE_REQUEST = 0: Int
```

### UNSET

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

```
const val UNSET = -1: Int
```

## Public constructors

### MotionScene

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

```
MotionScene(layout: MotionLayout!)
```

Create a motion scene.

| Parameters |
|---|---|
| `layout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!` | Motion layout to which the scene will be set. |

## Public functions

### addOnClickListeners

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

```
fun addOnClickListeners(motionLayout: MotionLayout!, currentState: Int): Unit
```

Add all on click listeners for the current state

| Parameters |
|---|---|
| `motionLayout: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionLayout!` |   |
| `currentState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |

### addTransition

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

```
fun addTransition(transition: MotionScene.Transition!): Unit
```

Add a transition to the motion scene. If a transition with the same id already exists in the scene, the new transition will replace the existing one.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the transition does not have an id. |

### applyViewTransition

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

```
fun applyViewTransition(
    viewTransitionId: Int,
    motionController: MotionController!
): Boolean
```

Apply a view transition to the MotionController

| Parameters |
|---|---|
| `viewTransitionId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | of viewTransition |
| `motionController: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionController!` |   |

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

### bestTransitionFor

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

```
fun bestTransitionFor(
    currentState: Int,
    dx: Float,
    dy: Float,
    lastTouchDown: MotionEvent!
): MotionScene.Transition!
```

Find the best transition for the motion

| Parameters |
|---|---|
| `currentState: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |
| `dx: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | drag delta x |
| `dy: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | drag delta y |
| `lastTouchDown: https://developer.android.com/reference/android/view/MotionEvent.html!` |   |

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

### disableAutoTransition

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

```
fun disableAutoTransition(disable: Boolean): Unit
```

this allow disabling autoTransitions to prevent design surface from being in undefined states

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

### enableViewTransition

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

```
fun enableViewTransition(id: Int, enable: Boolean): Unit
```

Enable this viewTransition

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

### gatPathMotionArc

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

```
fun gatPathMotionArc(): Int
```

The transition arc path mode

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

### getConstraintSet

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

```
fun getConstraintSet(context: Context!, id: String!): ConstraintSet!
```

Get the constraintSet given the id

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` |   |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` |   |

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

### getConstraintSetIds

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

```
fun getConstraintSetIds(): Array<Int>!
```

Get the list of all Constraint Sets Know to the system

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

### getDefinedTransitions

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

```
fun getDefinedTransitions(): ArrayList<MotionScene.Transition!>!
```

Get list of Transitions know to the system

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!>!` |   |

### getDuration

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

```
fun getDuration(): Int
```

Get Duration of the current transition.

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

### getInterpolator

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

```
fun getInterpolator(): Interpolator!
```

Get the interpolator define for the current Transition

| Returns |
|---|---|
| `https://developer.android.com/reference/android/view/animation/Interpolator.html!` |   |

### getKeyFrames

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

```
fun getKeyFrames(motionController: MotionController!): Unit
```

provides the key frames \&CycleFrames to the motion view to

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

### getMatchingStateLabels

```
fun getMatchingStateLabels(types: Array<String!>!): Array<Int>!
```

Get the id's of all constraintSets with the matching types

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

### getPathPercent

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

```
fun getPathPercent(view: View!, position: Int): Float
```

Get the path percent (Non functional currently)

| Parameters |
|---|---|
| `view: https://developer.android.com/reference/android/view/View.html!` |   |
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |

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

### getStaggered

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

```
fun getStaggered(): Float
```

Get the staggered value of the current transition. Will default to 0 staggered if there is no current transition.

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

### getTransitionById

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

```
fun getTransitionById(id: Int): MotionScene.Transition!
```

Find the transition based on the id

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

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

### getTransitionsWithState

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

```
fun getTransitionsWithState(stateId: Int): (Mutable)List<MotionScene.Transition!>!
```

Get all transitions that include this state

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

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!>!` |   |

### isViewTransitionEnabled

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

```
fun isViewTransitionEnabled(id: Int): Boolean
```

Is this view transition enabled

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

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

### lookUpConstraintId

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

```
fun lookUpConstraintId(id: String!): Int
```

Used at design time

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

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

### lookUpConstraintName

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

```
fun lookUpConstraintName(id: Int): String!
```

used at design time

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

### removeTransition

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

```
fun removeTransition(transition: MotionScene.Transition!): Unit
```

Remove the transition with the matching id from the motion scene. If no matching transition is found, it does nothing.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the transition does not have an id. |

### setConstraintSet

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

```
fun setConstraintSet(id: Int, set: ConstraintSet!): Unit
```

Maps the Constraint set to the id.

| Parameters |
|---|---|
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | - unique id to represent the ConstraintSet |
| `set: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintSet!` | - ConstraintSet to be represented with the id. |

### setDuration

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

```
fun setDuration(duration: Int): Unit
```

Sets the duration of the current transition or the default if there is no current transition

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

### setKeyframe

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

```
fun setKeyframe(view: View!, position: Int, name: String!, value: Any!): Unit
```

Set a keyFrame on the current Transition

| Parameters |
|---|---|
| `view: https://developer.android.com/reference/android/view/View.html!` |   |
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` |   |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` |   |

### setRtl

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

```
fun setRtl(rtl: Boolean): Unit
```

Set Right to left

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

### setTransition

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

```
fun setTransition(transition: MotionScene.Transition!): Unit
```

Set the transition to be the current transition of the motion scene.

| Parameters |
|---|---|
| `transition: https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene.Transition!` | a transition to be set. The transition must exist within the motion scene. (e.g. `https://developer.android.com/reference/kotlin/androidx/constraintlayout/motion/widget/MotionScene#addTransition(androidx.constraintlayout.motion.widget.MotionScene.Transition)`) |

### stripID

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

```
java-static fun stripID(id: String!): String!
```

Utility to strip the @id/ from an id

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

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

### validateLayout

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

```
fun validateLayout(layout: MotionLayout!): Boolean
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the layout is valid for the scene. False otherwise. Use it for the debugging purposes. |

### viewTransition

```
fun viewTransition(id: Int, view: Array<View!>!): Unit
```

Apply the viewTransition on the list of views

| Parameters |
|---|---|
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` |   |
| `view: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/android/view/View.html!>!` |   |

## Protected functions

### onLayout

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

```
protected fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit
```