Kebbin
01/18/2022, 2:20 PManimatePanBy
and animateRotateBy
, but one runs, then the other after the first has finished. So the object pans across, then rotates.
I'd like the object to pan while it is rotating. Is this possible somehow?
Thanks! Goodnight all.Zach Klippenstein (he/him) [MOD]
01/18/2022, 4:28 PMKebbin
01/19/2022, 1:26 AM.onPointerEvent(PointerEventType.Press) {
if (this.currentEvent.buttons.isSecondaryPressed) {
sendData("110 2")
coroutineScope.launch {
state.animatePanBy(Offset(x, y) - offsetXY)
state.animateRotateBy(0f - rotation)
}
}
}
.onPointerEvent(PointerEventType.Press) {
if (this.currentEvent.buttons.isSecondaryPressed) {
sendData("110 2")
coroutineScope.launch { state.animatePanBy(Offset(x, y) - offsetXY) }
coroutineScope.launch { state.animateRotateBy(0f - rotation) }
}
Zach Klippenstein (he/him) [MOD]
01/19/2022, 1:32 PManimatePanBy
and animateRotateBy
are operating on the same state object then I would guess they might be doing some sort of internal synchronization to explicitly prevent this use case. If you stored offset and rotation in separate animated states, the concurrent coroutines should work as expected. I’m not sure what state
is here and how those animate functions are implemented (they don’t look like they’re from the Compose stdlib) so I can’t say for sure.Kebbin
01/19/2022, 2:02 PM