# AndroidUiFrameClock

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/platform/AndroidUiFrameClock.android.kt+class:androidx.compose.ui.platform.AndroidUiFrameClock) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- android

  ```
  class AndroidUiFrameClock : MonotonicFrameClock
  ```

*** ** * ** ***

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiFrameClock#AndroidUiFrameClock(android.view.Choreographer)(choreographer: https://developer.android.com/reference/android/view/Choreographer.html)` | android |

| ### Public functions |
|---|---|---|
| `open suspend R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiFrameClock#withFrameNanos(kotlin.Function1)(onFrame: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) -> R)` Suspends until a new frame is requested, immediately invokes `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock#withFrameNanos(kotlin.Function1)` with the frame time in nanoseconds in the calling context of frame dispatch, then resumes with the result from `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock#withFrameNanos(kotlin.Function1)`. | android |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/android/view/Choreographer.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiFrameClock#choreographer()` | android |

| ### Inherited functions |
|---|
| From [kotlin.coroutines.CoroutineContext](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html) |---|---|---| | `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/plus.html(context: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html)` | android | |
| From [kotlin.coroutines.CoroutineContext.Element](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/index.html) |---|---|---| | `open R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/fold.html(initial: R, operation: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/index.html, R) -> R)` | android | | `open operator E?` | `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/index.html> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/get.html(key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-key/index.html<E>)` | android | | `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/minus-key.html(key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-key/index.html<*>)` | android | |

| ### Inherited properties |
|---|
| From [androidx.compose.runtime.MonotonicFrameClock](https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock) |---|---|---| | `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-key/index.html<*>` | `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock#key()` | android | |

## Public constructors

### AndroidUiFrameClock

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
AndroidUiFrameClock(choreographer: Choreographer)
```

## Public functions

### withFrameNanos

android

```
open suspend fun <R : Any?> withFrameNanos(onFrame: (Long) -> R): R
```

Suspends until a new frame is requested, immediately invokes `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock#withFrameNanos(kotlin.Function1)` with the frame time in nanoseconds in the calling context of frame dispatch, then resumes with the result from `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock#withFrameNanos(kotlin.Function1)`.

`frameTimeNanos` should be used when calculating animation time deltas from frame to frame as it may be normalized to the target time for the frame, not necessarily a direct, "now" value.

The time base of the value provided by `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock#withFrameNanos(kotlin.Function1)` is implementation defined. Time values provided are strictly monotonically increasing; after a call to `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock#withFrameNanos(kotlin.Function1)` completes it must not provide the same value again for a subsequent call.

## Public properties

### choreographer

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val choreographer: Choreographer
```