View ticker_final.kt
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
private val TickerCycleMillis = 150 | |
private object AlphabetMapper { | |
private val Alphabet = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789•".toList() | |
val size: Int = Alphabet.size | |
fun getLetterAt(index: Int): Char = Alphabet[index % size] | |
fun getIndexOf(letter: Char, offset: Int = 0): TickerIndex { |
View ticker_board.kt
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 TickerBoard( | |
// 1 | |
text: String, | |
// 2 | |
numColumns: Int, | |
// 3 | |
numRows: Int, | |
modifier: Modifier = Modifier, | |
textColor: Color = Color.White, |
View ticker_row.kt
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 TickerRow( | |
// 1 | |
text: String, | |
// 2 | |
numCells: Int, | |
modifier: Modifier = Modifier, | |
textColor: Color = Color.White, | |
backgroundColor: Color = Color.Black, | |
fontSize: TextUnit = 96.sp, |
View ticker_ticker_v1.kt
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 animatable = remember { |
View ticker_alphabet.kt
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
private object AlphabetMapper { | |
// 1 | |
private val Alphabet = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789•".toList() | |
val size: Int = Alphabet.size | |
// 2 | |
fun getLetterAt(index: Int): Char = Alphabet[index % size] | |
// 3 |
View ticker_basic_layout.kt
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 */ |
View ticker_bottom_half.kt
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 | |
private fun BottomHalf( | |
modifier: Modifier = Modifier, | |
content: @Composable () -> Unit, | |
) { | |
Layout( | |
modifier = modifier.clipToBounds(), | |
content = content, | |
) { measurables, constraints -> | |
require(measurables.size == 1) { "This composable expects a single child" } |
View ticker_top_half.kt
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 | |
private fun TopHalf( | |
modifier: Modifier = Modifier, | |
content: @Composable () -> Unit, | |
) { | |
// 1 | |
Layout( | |
// 2 | |
modifier = modifier.clipToBounds(), | |
content = content, |
View ticker_centered_text.kt
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 CenteredText( | |
letter: Char, | |
modifier: Modifier = Modifier, | |
textColor: Color = Color.White, | |
backgroundColor: Color = Color.Black, | |
fontSize: TextUnit = 96.sp, | |
) { | |
// 1 | |
var ascent by remember { |
View ticker_text_properties.kt
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
Text( | |
text = letter.toString(), | |
color = textColor, | |
fontFamily = FontFamily.Monospace, | |
fontSize = fontSize, | |
modifier = modifier | |
.background(backgroundColor) | |
.drawBehind { | |
drawLine( | |
Color.Red, |
NewerOlder