https://kotlinlang.org logo
#compose
Title
# compose
b

bruno.aybar

09/26/2020, 10:13 PM
Hello, is there any modifier to apply rotation? My use case:
Copy code
Stack {
   Image(Modifier.alignment(Alignment.Center)) // want to center & rotate 45 degrees
}
y

Yann Badoual

09/26/2020, 10:19 PM
Modifier.layer(rotationX = ..., rotationY = ..., transformOrigin = TransformOrigin.Center)
🙌 1
👆🏼 1
the
layer
modifier handles stuff like alpha, scale, rotation, translation, ...
b

bruno.aybar

09/26/2020, 10:37 PM
thank you @Yann Badoual, that's exactly what I needed
for the Compose team: it took me a while to figure out that I needed to use
rotationZ
... Maybe it's just my lack of initial understanding of rotating axes, but perhaps the kdocs for
drawLayer
rotation params can elaborate a bit more, maybe include samples? Or maybe even provide a more straightforward extension with samples? (i.e. similar to
drawOpacity
for alpha)