androidx.compose.ui

preferredFrameRateSince 1.9

Function · from org.jetbrains.compose.ui:ui:1.12.2

No hand-written docs yet.

Set a requested frame rate on Composable

With frameRate

fun Modifier.preferredFrameRate(frameRate: Float): Float

frameRate: FloatRequired

The preferred frame rate the content should be rendered at. Default value is 0.

With frameRateCategory

fun Modifier.preferredFrameRate(frameRateCategory: FrameRateCategory): Float

frameRateCategory: FrameRateCategoryRequired

The preferred frame rate category the content should be rendered at.

Library docs

Set a requested frame rate on Composable

You can set the preferred frame rate (frames per second) for a Composable using a non-negative number. This API should only be used when a specific frame rate is needed for your Composable. For example, 24 or 30 for video play.

If multiple frame rates are requested, they will be aggregated to determine a feasible frame rate.

If you no longer want this modifier to influence the frame rate, clear the preference by setting it to 0.

Keep in mind that the preferred frame rate affects the frame rate for the next frame, so use this method carefully. It's important to note that the preference is valid as long as the Composable is drawn.