Google is committed to advancing racial equity for Black communities. See how.

ChoreographerCompositionFrameClock

class ChoreographerCompositionFrameClock : CompositionFrameClock
kotlin.Any
   ↳ androidx.compose.ChoreographerCompositionFrameClock

A CompositionFrameClock driven by an android.view.Choreographer.

Summary

Public constructors

<init>(choreographer: Choreographer)

A CompositionFrameClock driven by an android.view.Choreographer.

Public methods

suspend R
awaitFrameNanos(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.

Inherited extension functions

From androidx.compose
suspend R
CompositionFrameClock.awaitFrameMillis(crossinline onFrame: (frameTimeMillis: 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.

suspend Long

Suspends until a new frame is requested, returning the frame time in milliseconds.

suspend Long

Suspends until a new frame is requested, returning the frame time in nanoseconds.

Properties

Choreographer

Public constructors

<init>

ChoreographerCompositionFrameClock(choreographer: Choreographer)

A CompositionFrameClock driven by an android.view.Choreographer.

Public methods

awaitFrameNanos

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

Properties

choreographer

val choreographer: Choreographer