Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Party time #5

wants to merge 2 commits into from

Conversation

JEphron
Copy link
Collaborator

@JEphron JEphron commented Apr 19, 2021

A bit wacky right now as it runs on every submission. Needs to be restricted to valid words (or maybe even just to pangrams)

val confettiColors = remember { listOf(Color.Red, Color.Green, Color.Blue, Color.Yellow) }

val infiniteTransition = rememberInfiniteTransition()
val alpha by infiniteTransition.animateFloat(
Copy link
Collaborator Author

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.

Copy link
Owner

@Plastix Plastix left a 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) {
Copy link
Owner

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)
Copy link
Owner

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)
Copy link
Owner

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;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semi-colon ;)

Comment on lines +161 to +162
for (i in 0..n) {
states += rememberConfettiState(
Copy link
Owner

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(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants