AndroidUiFrameClock


Summary

Public constructors

android

Public functions

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

Suspends until a new frame is requested, immediately invokes onFrame with the frame time in nanoseconds in the calling context of frame dispatch, then resumes with the result from onFrame.

android

Public properties

Choreographer
android

Inherited functions

From kotlin.coroutines.CoroutineContext
open operator CoroutineContext
android
From kotlin.coroutines.CoroutineContext.Element
open R
<R : Any?> fold(initial: R, operation: (CoroutineContext.Element, R) -> R)
android
open operator E?
android
open CoroutineContext
android

Inherited properties

From androidx.compose.runtime.MonotonicFrameClock
open CoroutineContext.Key<*>
android

Public constructors

AndroidUiFrameClock

AndroidUiFrameClock(choreographer: Choreographer)

Public functions

withFrameNanos

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

Suspends until a new frame is requested, immediately invokes onFrame with the frame time in nanoseconds in the calling context of frame dispatch, then resumes with the result from onFrame.

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 withFrameNanos is implementation defined. Time values provided are strictly monotonically increasing; after a call to withFrameNanos completes it must not provide the same value again for a subsequent call.

Public properties

choreographer

val choreographerChoreographer