Created
March 4, 2023 23:53
-
-
Save fvilarino/beb7ade5ad31bb0470adb59487cde491 to your computer and use it in GitHub Desktop.
Ticker - Basic Layout
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
@Composable | |
fun Ticker( | |
letter: Char, | |
modifier: Modifier = Modifier, | |
textColor: Color = Color.White, | |
backgroundColor: Color = Color.Black, | |
fontSize: TextUnit = 96.sp, | |
) { | |
// 1 | |
val currentLetter = /* TODO */ | |
val nextLetter = /* TODO */ | |
// 2 | |
Box( | |
modifier = modifier | |
) { | |
// 3 | |
CenteredText( | |
letter = nextLetter, | |
textColor = textColor, | |
backgroundColor = backgroundColor, | |
fontSize = fontSize, | |
) | |
// 4 | |
Column { | |
// 5 | |
Box( | |
// 6 | |
modifier = Modifier.zIndex(1f) | |
) { | |
// 7 | |
if (/* 1/2 half of animation */ ) { | |
TopHalf { | |
CenteredText( | |
letter = currentLetter, | |
textColor = textColor, | |
backgroundColor = backgroundColor, | |
fontSize = fontSize, | |
) | |
} | |
} else { | |
BottomHalf( | |
modifier = Modifier.graphicsLayer { | |
rotationX = 180f | |
} | |
) { | |
CenteredText( | |
letter = nextLetter, | |
textColor = textColor, | |
backgroundColor = backgroundColor, | |
fontSize = fontSize, | |
) | |
} | |
} | |
} | |
// 8 | |
BottomHalf { | |
CenteredText( | |
letter = currentLetter, | |
textColor = textColor, | |
backgroundColor = backgroundColor, | |
fontSize = fontSize, | |
) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment