rotate

Compose Modifier

Common
fun Modifier.rotate(degrees: Float) =
    if (degrees != 0f) graphicsLayer(rotationZ = degrees) else this

Sets the degrees the view is rotated around the center of the composable. Increasing values result in clockwise rotation. Negative degrees are used to rotate in the counter clockwise direction

Usage of this API renders this composable into a separate graphics layer.

Code Examples

RotateSample

@Composable
fun RotateSample() {
    Box(Modifier.rotate(45f).size(100.dp, 100.dp))
}