rotate

Function

Common
fun Canvas.rotate(degrees: Float, pivotX: Float, pivotY: Float)

Add a rotation (in degrees clockwise) to the current transform at the given pivot point. The pivot coordinate remains unchanged by the rotation transformation

Parameters

degreesto rotate clockwise
pivotXThe x-coord for the pivot point
pivotYThe y-coord for the pivot point
Common
inline fun DrawScope.rotate(degrees: Float, pivot: Offset = center, block: DrawScope.() -> Unit) =
    withTransform({ rotate(degrees, pivot) }, block)

Add a rotation (in degrees clockwise) to the current transform at the given pivot point. The pivot coordinate remains unchanged by the rotation transformation. After the provided lambda is invoked, the rotation transformation is undone.

Parameters

degreesto rotate clockwise
pivotThe coordinate for the pivot point, defaults to the center of the coordinate space
blocklambda that is called to issue drawing commands within the rotated coordinate space