This file contains hidden or 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 RotatingPokeball() { | |
val children: @Composable() () -> Unit = { | |
Opacity(opacity = 0.75f) { | |
DrawImage( | |
image = +imageResource(R.drawable.pokeball), | |
tint = +colorResource(R.color.poke_red) | |
) | |
} | |
} |
This file contains hidden or 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 rotation = FloatPropKey() | |
private val definition = transitionDefinition { | |
state(0) { this[rotation] = 0f } | |
state(1) { this[rotation] = 360f } | |
transition { | |
rotation using repeatable { | |
animation = tween { duration = 1000 } | |
iterations = Infinite |
This file contains hidden or 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
animation = tween { | |
duration = 1000 | |
easing = LinearEasing | |
} |
This file contains hidden or 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 rotation = FloatPropKey() | |
private fun createDefinition(duration: Int) = transitionDefinition { | |
state(0) { this[rotation] = 0f } | |
state(1) { this[rotation] = 360f } | |
transition { | |
rotation using repeatable { | |
animation = tween { | |
easing = LinearEasing |
This file contains hidden or 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 RotatingPokeBall() { | |
RotateIndefinitely(durationPerRotation = 4000) { | |
Opacity(opacity = 0.75f) { | |
DrawImage( | |
image = +imageResource(R.drawable.pokeball), | |
tint = +colorResource(R.color.poke_red) | |
) | |
} | |
} |
This file contains hidden or 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 RotatingText() { | |
RotateIndefinitely(durationPerRotation = 4000) { | |
Text("Rotating text!") | |
} | |
} |
This file contains hidden or 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 Square(isDarkSquare: Boolean) { | |
Canvas(modifier = Modifier.fillMaxSize(1f)) { | |
drawRect(color = if (isDarkSquare) darkSquareColor else lightSquareColor) | |
} | |
} |
This file contains hidden or 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 Board() { | |
Box(Modifier.fillMaxSize().aspectRatio(1f)) { | |
Column { | |
for (rank in 8 downTo 1) { | |
Row(modifier = Modifier.weight(1f)) { | |
for (file in 1..8) { | |
Square(Modifier.weight(1f).fillMaxSize(), /* other params */) | |
} | |
} |
This file contains hidden or 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 Piece(pieceModel: Piece) { | |
Text( | |
text = pieceModel.symbol, | |
fontSize = 28.sp | |
) | |
} |
This file contains hidden or 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 Piece(pieceModel: Piece) { | |
Icon( | |
painter = painterResource(id = pieceModel.asset), | |
tint = Color.Unspecified | |
) | |
} |