Last active
February 22, 2023 20:49
-
-
Save Kpeved/af43608d64310138167a8311e53e76e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var strokeWidth by remember { mutableStateOf(0f) } | |
Spacer(modifier = Modifier | |
.fillMaxSize() | |
// Set strokeWidth based on the size of the viewport | |
.onGloballyPositioned { | |
strokeWidth = (it.size.width / 24).toFloat() | |
} | |
.drawBehind { | |
val center = Offset(size.width / 2, size.height / 2) | |
val endOffset = Offset(size.width / 2, 0f) | |
// Rotate the line around the pivot point, which is the | |
// center of the screen. Rotation goes from 0 to 720 degrees | |
rotate(clockAnimation, pivot = center) { | |
drawLine( | |
color = Color.White, | |
start = center, | |
end = endOffset, | |
strokeWidth = strokeWidth, | |
) | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment