-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Party time #5
base: main
Are you sure you want to change the base?
Party time #5
Conversation
val confettiColors = remember { listOf(Color.Red, Color.Green, Color.Blue, Color.Yellow) } | ||
|
||
val infiniteTransition = rememberInfiniteTransition() | ||
val alpha by infiniteTransition.animateFloat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotta remind me to swap out the infiniteTransition for a normal animation. It's easier to test if you can let it loop, but no reason to leave it like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Another idea would be to animate the line height on the confetti so it looks like it is "fluttering". Some ideas: https://github.com/DanielMartinus/Konfetti
import kotlin.math.cos | ||
import kotlin.math.sin | ||
|
||
data class Projectile(val origin: Offset, val angle: Float, val speed: Float, val color: Color, val gravity: Float) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about making these data classes and helper functions private?
@Composable | ||
fun PuzzleDetailScreen(viewModel: PuzzleDetailViewModel) { | ||
when (val state = | ||
viewModel.viewStates.observeAsState(PuzzleDetailViewState.Loading).value) { | ||
is PuzzleDetailViewState.Loading -> PuzzleDetailLoadingState() | ||
is PuzzleDetailViewState.Success -> { | ||
val gameState = state.boardGameState | ||
// ConfettiCanvas(gameState.activeWordToast != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the Confetti canvas! It would be nice if the animation duration wasn't tied to word toast length
@Composable | ||
fun PuzzleDetailScreen(viewModel: PuzzleDetailViewModel) { | ||
when (val state = | ||
viewModel.viewStates.observeAsState(PuzzleDetailViewState.Loading).value) { | ||
is PuzzleDetailViewState.Loading -> PuzzleDetailLoadingState() | ||
is PuzzleDetailViewState.Success -> { | ||
val gameState = state.boardGameState | ||
// ConfettiCanvas(gameState.activeWordToast != null) | ||
FireworksCanvas(gameState.activeWordToast != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to put this after the dialog code in this block so the confetti renders over all the other UI elements
|
||
val confettiColors = remember { listOf(Color.Red, Color.Green, Color.Blue, Color.Yellow) } | ||
val states = mutableListOf<ConfettiState>() | ||
val n = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semi-colon ;)
for (i in 0..n) { | ||
states += rememberConfettiState( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val states = List(n) { i ->
rememberConfettiState(
A bit wacky right now as it runs on every submission. Needs to be restricted to valid words (or maybe even just to pangrams)