withFrameMillis
public suspend inline fun <R> MonotonicFrameClock.withFrameMillis(
crossinline onFrame: (frameTimeMillis: Long) -> R
): R
Suspends until a new frame is requested, immediately invokes onFrame
with the frame time in
milliseconds in the calling context of frame dispatch, then resumes with the result from
onFrame
.
frameTimeMillis
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 MonotonicFrameClock.withFrameMillis
is implementation
defined. Time values provided are monotonically increasing; after a call to withFrameMillis
completes it must not provide a smaller value for a subsequent call.
public suspend fun <R> withFrameMillis(onFrame: (frameTimeMillis: Long) -> R): R
Suspends until a new frame is requested, immediately invokes onFrame
with the frame time in
milliseconds in the calling context of frame dispatch, then resumes with the result from
onFrame
.
frameTimeMillis
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 MonotonicFrameClock.withFrameMillis
is implementation
defined. Time values provided are monotonically increasing; after a call to withFrameMillis
completes it must not provide a smaller value for a subsequent call.
This function will invoke MonotonicFrameClock.withFrameNanos
using the calling
CoroutineContext
's MonotonicFrameClock
and will throw an IllegalStateException
if one is
not present in the CoroutineContext
.