# TransitionSeekController

# TransitionSeekController

Artifact:[androidx.transition:transition](https://developer.android.com/jetpack/androidx/releases/transition)  
[View Source](https://cs.android.com/search?q=file:androidx/transition/TransitionSeekController.java+class:androidx.transition.TransitionSeekController)  
Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/transition#1.5.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/transition/TransitionSeekController "View this page in Java")

<br />

```
interface TransitionSeekController
```

<br />

*** ** * ** ***

Returned from[controlDelayedTransition](https://developer.android.com/reference/kotlin/androidx/transition/TransitionManager#controlDelayedTransition(android.view.ViewGroup,androidx.transition.Transition))to allow manually controlling the animations within a Transition using[setCurrentPlayTimeMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentPlayTimeMillis(long)). The transition will be ready to seek when[isReady](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#isReady())is`true`.

## Summary

|                                                                                          ### Public functions                                                                                          |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                          | [addOnProgressChangedListener](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#addOnProgressChangedListener(androidx.core.util.Consumer<androidx.transition.TransitionSeekController>))`(` ` consumer: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[TransitionSeekController](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController)`!>` `)` Add a listener for whenever the progress of the transition is changed.                                                                                                                                                                                                                  |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                          | [addOnReadyListener](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#addOnReadyListener(androidx.core.util.Consumer<androidx.transition.TransitionSeekController>))`(onReadyListener: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[TransitionSeekController](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController)`!>)` Adds a listener to know when[isReady](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#isReady())is`true`.                                                                                                                                                       |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                          | [animateToEnd](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#animateToEnd())`()` Runs the animation forwards toward the end.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                          | [animateToStart](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#animateToStart(java.lang.Runnable))`(resetToStartState: `[Runnable](https://developer.android.com/reference/java/lang/Runnable.html)`)` Runs the animation backwards toward the start.                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `@`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | [getCurrentFraction](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#getCurrentFraction())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `@`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                   | [getCurrentPlayTimeMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#getCurrentPlayTimeMillis())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `@`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                   | [getDurationMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#getDurationMillis())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                    | [isReady](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#isReady())`()` Returns`true`when the Transition is ready to seek or`false`when the Transition's animations have yet to be built.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                          | [removeOnProgressChangedListener](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#removeOnProgressChangedListener(androidx.core.util.Consumer<androidx.transition.TransitionSeekController>))`(` ` consumer: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[TransitionSeekController](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController)`!>` `)` Remove a listener previously added in[addOnProgressChangedListener](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#addOnProgressChangedListener(androidx.core.util.Consumer<androidx.transition.TransitionSeekController>))          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                          | [removeOnReadyListener](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#removeOnReadyListener(androidx.core.util.Consumer<androidx.transition.TransitionSeekController>))`(` ` onReadyListener: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[TransitionSeekController](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController)`!>` `)` Removes`onReadyListener`that was previously added in[addOnReadyListener](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#addOnReadyListener(androidx.core.util.Consumer<androidx.transition.TransitionSeekController>))so that it won't be called. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                          | [setCurrentFraction](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentFraction(float))`(fraction: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Sets the position of the Transition's animation.                                                                                                                                                                                                                                                                                                                                                     |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                                                                                          | [setCurrentPlayTimeMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentPlayTimeMillis(long))`(playTimeMillis: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Sets the position of the Transition's animation.                                                                                                                                                                                                                                                                                                                                                      |

## Public functions

### addOnProgressChangedListener

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

```
fun addOnProgressChangedListener(
    consumer: Consumer<TransitionSeekController!>
): Unit
```

Add a listener for whenever the progress of the transition is changed. This will be called when[setCurrentPlayTimeMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentPlayTimeMillis(long))or[setCurrentFraction](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentFraction(float))are called as well as when the animation from[animateToEnd](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#animateToEnd())or[animateToStart](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#animateToStart(java.lang.Runnable))changes the progress.  

|                                                                                                            Parameters                                                                                                            |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| `consumer: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[TransitionSeekController](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController)`!>` | A method that accepts this TransitionSeekController. |

### addOnReadyListener

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

```
fun addOnReadyListener(onReadyListener: Consumer<TransitionSeekController!>): Unit
```

Adds a listener to know when[isReady](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#isReady())is`true`. The listener will be removed once notified as[isReady](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#isReady())can only be made true once. If[isReady](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#isReady())is already`true`, then it will be notified immediately.  

|                                                                                                               Parameters                                                                                                                |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| `onReadyListener: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[TransitionSeekController](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController)`!>` | The listener to be notified when the Transition is ready. |

### animateToEnd

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

```
fun animateToEnd(): Unit
```

Runs the animation forwards toward the end.[setCurrentPlayTimeMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentPlayTimeMillis(long))will not be allowed after executing this. When the animation completes,[onTransitionEnd](https://developer.android.com/reference/kotlin/androidx/transition/Transition.TransitionListener#onTransitionEnd(androidx.transition.Transition))will be called with the`isReverse`parameter`false`. After the Transition ends, the state will reach the final state set after[controlDelayedTransition](https://developer.android.com/reference/kotlin/androidx/transition/TransitionManager#controlDelayedTransition(android.view.ViewGroup,androidx.transition.Transition)). After calling this,[setCurrentPlayTimeMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentPlayTimeMillis(long))may not be called.  

### animateToStart

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

```
fun animateToStart(resetToStartState: Runnable): Unit
```

Runs the animation backwards toward the start.[setCurrentPlayTimeMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentPlayTimeMillis(long))will not be allowed after executing this. When the animation completes,`resetToStart`will be executed to set the state back to the starting state and[onTransitionEnd](https://developer.android.com/reference/kotlin/androidx/transition/Transition.TransitionListener#onTransitionEnd(androidx.transition.Transition))will be called with the`isReverse`parameter`true`. If`resetToStartState`does not properly set the state back to starting state,[onTransitionEnd](https://developer.android.com/reference/kotlin/androidx/transition/Transition.TransitionListener#onTransitionEnd(androidx.transition.Transition))will still be called, but the UI will jump to the end state instead of the start state.  

### getCurrentFraction

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

```
fun getCurrentFraction(): @FloatRange(from = 0.0, to = 1.0) Float
```  

|                                                                                                Returns                                                                                                 |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| `@`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The fraction, between 0 and 1, inclusive, of the progress of the transition. |

|                                                                      See also                                                                      |
|----------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getCurrentPlayTimeMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#getCurrentPlayTimeMillis()) |   |

### getCurrentPlayTimeMillis

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

```
fun getCurrentPlayTimeMillis(): @IntRange(from = 0) Long
```  

|                                                                                       Returns                                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The time, in milliseconds, of the animation. This will be between 0 and[getDurationMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#getDurationMillis()). |

### getDurationMillis

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

```
fun getDurationMillis(): @IntRange(from = 0) Long
```  

|                                                                                       Returns                                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| `@`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The total duration, in milliseconds, of the Transition's animations. |

### isReady

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

```
fun isReady(): Boolean
```

Returns`true`when the Transition is ready to seek or`false`when the Transition's animations have yet to be built.  

### removeOnProgressChangedListener

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

```
fun removeOnProgressChangedListener(
    consumer: Consumer<TransitionSeekController!>
): Unit
```

Remove a listener previously added in[addOnProgressChangedListener](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#addOnProgressChangedListener(androidx.core.util.Consumer<androidx.transition.TransitionSeekController>))  

|                                                                                                            Parameters                                                                                                            |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| `consumer: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[TransitionSeekController](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController)`!>` | The listener to be removed. |

### removeOnReadyListener

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

```
fun removeOnReadyListener(
    onReadyListener: Consumer<TransitionSeekController!>
): Unit
```

Removes`onReadyListener`that was previously added in[addOnReadyListener](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#addOnReadyListener(androidx.core.util.Consumer<androidx.transition.TransitionSeekController>))so that it won't be called.  

|                                                                                                               Parameters                                                                                                                |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| `onReadyListener: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[TransitionSeekController](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController)`!>` | The listener to be removed so that it won't be notified when ready. |

### setCurrentFraction

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

```
fun setCurrentFraction(fraction: @FloatRange(from = 0.0, to = 1.0) Float): Unit
```

Sets the position of the Transition's animation.`fraction`should be between 0 and 1, inclusive, where 0 indicates that the transition hasn't progressed and 1 indicates that the transition is completed. Calling this before[isReady](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#isReady())is`true`will do nothing.  

|                                                                                                    Parameters                                                                                                    |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| `fraction: @`[FloatRange](https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange)`(from = 0.0, to = 1.0) `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The fraction, between 0 and 1, inclusive, of the progress of the transition. |

|                                                                        See also                                                                        |
|--------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setCurrentPlayTimeMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentPlayTimeMillis(long)) |   |

### setCurrentPlayTimeMillis

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

```
fun setCurrentPlayTimeMillis(playTimeMillis: @IntRange(from = 0) Long): Unit
```

Sets the position of the Transition's animation.`playTimeMillis`should be between 0 and[getDurationMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#getDurationMillis()). Calling this before[isReady](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#isReady())is`true`will do nothing.  

|                                                                                              Parameters                                                                                              |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `playTimeMillis: @`[IntRange](https://developer.android.com/reference/kotlin/androidx/annotation/IntRange)`(from = 0) `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The time, between 0 and[getDurationMillis](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#getDurationMillis())that the animation should play. |

|                                                                  See also                                                                   |
|---------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setCurrentFraction](https://developer.android.com/reference/kotlin/androidx/transition/TransitionSeekController#setCurrentFraction(float)) |   |