Compose Modifier

preferredFrameRate

Set a requested frame rate on Composable

preferredFrameRate

Common
fun Modifier.preferredFrameRate(@FloatRange(from = 0.0, to = 360.0) frameRate: Float) =
    this.graphicsLayer().frameRate(frameRate)

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.

Parameters

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

preferredFrameRate

Common
fun Modifier.preferredFrameRate(frameRateCategory: FrameRateCategory) =
    this.graphicsLayer().frameRate(frameRateCategory.value)

Set a requested frame rate on Composable

You can set the preferred frame rate (frames per second) for a Composable using a frame rate category see: FrameRateCategory.

For increased frame rates, please consider using FrameRateCategory.High.

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.

Parameters

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