### Implement ConfettiKit Interactive Demo Source: https://context7.com/vinceglb/confettikit/llms.txt A full working example demonstrating how to trigger different confetti animation presets using UI controls. ```kotlin import androidx.compose.foundation.layout.* import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import io.github.vinceglb.confettikit.compose.ConfettiKit import io.github.vinceglb.confettikit.core.* import io.github.vinceglb.confettikit.core.emitter.Emitter import io.github.vinceglb.confettikit.core.models.Shape import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds @Composable fun ConfettiDemo() { var isAnimating by remember { mutableStateOf(false) } var presetIndex by remember { mutableStateOf(0) } val presets = listOf( // Explode listOf(Party( speed = 0f, maxSpeed = 30f, damping = 0.9f, spread = 360, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), emitter = Emitter(duration = 100.milliseconds).max(100) )), // Parade listOf( Party( speed = 10f, maxSpeed = 30f, angle = Angle.RIGHT - 45, spread = Spread.SMALL, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), emitter = Emitter(duration = 5.seconds).perSecond(30), position = Position.Relative(0.0, 0.5) ), Party( speed = 10f, maxSpeed = 30f, angle = Angle.LEFT + 45, spread = Spread.SMALL, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), emitter = Emitter(duration = 5.seconds).perSecond(30), position = Position.Relative(1.0, 0.5) ) ), // Rain listOf(Party( speed = 0f, maxSpeed = 15f, angle = Angle.BOTTOM, spread = Spread.ROUND, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), emitter = Emitter(duration = 3.5.seconds).perSecond(100), position = Position.Relative(0.0, 0.0).between(Position.Relative(1.0, 0.0)) )) ) Scaffold { Box( contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize() ) { Column( verticalArrangement = Arrangement.spacedBy(16.dp), horizontalAlignment = Alignment.CenterHorizontally ) { Text("ConfettiKit Demo") Button( enabled = !isAnimating, onClick = { isAnimating = true } ) { Text("Celebrate!") } } if (isAnimating) { ConfettiKit( modifier = Modifier.fillMaxSize(), parties = presets[presetIndex], onParticleSystemEnded = { _, activeSystems -> if (activeSystems == 0) { isAnimating = false presetIndex = (presetIndex + 1) % presets.size } } ) } } } } ``` -------------------------------- ### Build Library with Gradle Source: https://github.com/vinceglb/confettikit/blob/main/CLAUDE.md Use this command to build the Confettikit library. Ensure you have Gradle installed and the project is set up correctly. ```bash ./gradlew :confettikit:build ``` -------------------------------- ### Create Basic Confetti Animation Source: https://github.com/vinceglb/confettikit/blob/main/README.md The simplest way to add confetti is by using the ConfettiKit composable with a basic Party configuration. This example creates a full-screen confetti animation with 30 particles per second. ```kotlin ConfettiKit( modifier = Modifier.fillMaxSize(), parties = listOf( Party(emitter = Emitter(duration = 5.seconds).perSecond(30)) ) ) ``` -------------------------------- ### Run Sample Desktop App with Gradle Source: https://github.com/vinceglb/confettikit/blob/main/CLAUDE.md Use this command to launch the sample desktop application. This allows you to see the confetti animations in action on a desktop environment. ```bash ./gradlew :sample:desktopApp:run ``` -------------------------------- ### Run All Tests with Gradle Source: https://github.com/vinceglb/confettikit/blob/main/CLAUDE.md Execute this command to run all tests within the project. This is useful for verifying the integrity of the library and samples. ```bash ./gradlew allTests ``` -------------------------------- ### Publish to Maven Local with Gradle Source: https://github.com/vinceglb/confettikit/blob/main/CLAUDE.md This command publishes the library artifacts to your local Maven repository. It's essential for local testing of the library in other projects. ```bash ./gradlew publishToMavenLocal ``` -------------------------------- ### Implement Explode Animation Recipe Source: https://context7.com/vinceglb/confettikit/llms.txt Creates a burst of confetti originating from a single point, suitable for UI feedback. ```kotlin import io.github.vinceglb.confettikit.compose.ConfettiKit import io.github.vinceglb.confettikit.core.Party import io.github.vinceglb.confettikit.core.Position import io.github.vinceglb.confettikit.core.emitter.Emitter import io.github.vinceglb.confettikit.core.models.Shape import kotlin.time.Duration.Companion.milliseconds fun explodePreset(position: Position = Position.Relative(0.5, 0.5)): List { return listOf( Party( speed = 0f, // Start at zero maxSpeed = 30f, // Accelerate outward damping = 0.9f, // Moderate slowdown spread = 360, // Full circle burst colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), shapes = listOf(Shape.Circle, Shape.Square), position = position, emitter = Emitter(duration = 100.milliseconds).max(100) ) ) } // Usage @Composable fun ExplosionDemo() { ConfettiKit( modifier = Modifier.fillMaxSize(), parties = explodePreset() ) } ``` -------------------------------- ### Configure Particle Positions Source: https://context7.com/vinceglb/confettikit/llms.txt Defines spawn locations using absolute pixel coordinates, relative screen percentages, or random ranges between two points. ```kotlin import io.github.vinceglb.confettikit.core.Position import io.github.vinceglb.confettikit.core.Party import io.github.vinceglb.confettikit.core.emitter.Emitter import kotlin.time.Duration.Companion.seconds // Absolute position: exact pixel coordinates val absolutePosition = Position.Absolute(x = 100f, y = 200f) // Relative position: 0.0 to 1.0 range (responsive) val centerPosition = Position.Relative(0.5, 0.5) // Center val topLeftPosition = Position.Relative(0.0, 0.0) // Top-left val bottomRightPosition = Position.Relative(1.0, 1.0) // Bottom-right // Between: spawn randomly between two points (great for rain effects) val fullWidthTop = Position.Relative(0.0, 0.0).between(Position.Relative(1.0, 0.0)) // Example: Rain effect from full width of screen top val rainParty = Party( angle = 90, // Angle.BOTTOM spread = 360, position = Position.Relative(0.0, 0.0).between(Position.Relative(1.0, 0.0)), emitter = Emitter(duration = 5.seconds).perSecond(100) ) ``` -------------------------------- ### Run JVM Tests Only with Gradle Source: https://github.com/vinceglb/confettikit/blob/main/CLAUDE.md This command specifically runs tests targeting the Java Virtual Machine. It's helpful for isolating JVM-specific test failures. ```bash ./gradlew :confettikit:jvmTest ``` -------------------------------- ### Create a rain confetti effect in Kotlin Source: https://context7.com/vinceglb/confettikit/llms.txt Configures a party preset that spawns confetti across the top of the screen with a downward fall. Requires the ConfettiKit core and compose libraries. ```kotlin import io.github.vinceglb.confettikit.compose.ConfettiKit import io.github.vinceglb.confettikit.core.* import io.github.vinceglb.confettikit.core.emitter.Emitter import io.github.vinceglb.confettikit.core.models.Shape import kotlin.time.Duration.Companion.seconds fun rainPreset(): List { return listOf( Party( speed = 0f, maxSpeed = 15f, damping = 0.9f, angle = Angle.BOTTOM, // Fall downward spread = Spread.ROUND, // 360° for natural randomness colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), shapes = listOf(Shape.Circle, Shape.Square), emitter = Emitter(duration = 3.5.seconds).perSecond(100), // Spawn across entire top of screen position = Position.Relative(0.0, 0.0).between(Position.Relative(1.0, 0.0)) ) ) } // Usage @Composable fun RainDemo() { ConfettiKit( modifier = Modifier.fillMaxSize(), parties = rainPreset() ) } ``` -------------------------------- ### Implement custom confetti shapes in Kotlin Source: https://context7.com/vinceglb/confettikit/llms.txt Demonstrates how to define a custom shape class and integrate vector icons or images into the confetti particle system. ```kotlin import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Celebration import androidx.compose.runtime.Composable import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.* import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import io.github.vinceglb.confettikit.compose.ConfettiKit import io.github.vinceglb.confettikit.core.Party import io.github.vinceglb.confettikit.core.emitter.Emitter import io.github.vinceglb.confettikit.core.models.Shape import kotlin.time.Duration.Companion.seconds // Custom heart shape class HeartShape : androidx.compose.ui.graphics.Shape { override fun createOutline( size: Size, layoutDirection: LayoutDirection, density: Density ): Outline { val path = Path().apply { val width = size.width val height = size.height moveTo(width / 2, height / 5) cubicTo(5 * width / 14, 0f, 0f, height / 15, width / 28, 2 * height / 5) cubicTo(width / 14, 2 * height / 3, 3 * width / 7, 5 * height / 6, width / 2, height) cubicTo(4 * width / 7, 5 * height / 6, 13 * width / 14, 2 * height / 3, 27 * width / 28, 2 * height / 5) cubicTo(width, height / 15, 9 * width / 14, 0f, width / 2, height / 5) close() } return Outline.Generic(path) } } @Composable fun customShapesPreset(imageBitmap: ImageBitmap? = null): List { val vectorPainter = rememberVectorPainter(Icons.Outlined.Celebration) val shapes = mutableListOf( Shape.CustomShape(HeartShape()), Shape.CustomShape(CircleShape), Shape.CustomShape(RoundedCornerShape(5.dp)), Shape.Vector(vectorPainter) ) imageBitmap?.let { shapes.add(Shape.Image(it)) } return listOf( Party( speed = 15f, maxSpeed = 25f, damping = 0.9f, spread = 360, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), shapes = shapes, emitter = Emitter(duration = 3.seconds).perSecond(50) ) ) } ``` -------------------------------- ### Implement Parade Animation Recipe Source: https://context7.com/vinceglb/confettikit/llms.txt Streams confetti from both sides of the screen toward the center. ```kotlin import io.github.vinceglb.confettikit.compose.ConfettiKit import io.github.vinceglb.confettikit.core.* import io.github.vinceglb.confettikit.core.emitter.Emitter import kotlin.time.Duration.Companion.seconds fun paradePreset(): List { val leftParty = Party( speed = 10f, maxSpeed = 30f, damping = 0.9f, angle = Angle.RIGHT - 45, // Diagonal up-right spread = Spread.SMALL, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), emitter = Emitter(duration = 5.seconds).perSecond(30), position = Position.Relative(0.0, 0.5) // Left edge, middle ) val rightParty = leftParty.copy( angle = leftParty.angle - 90, // Diagonal up-left position = Position.Relative(1.0, 0.5) // Right edge, middle ) return listOf(leftParty, rightParty) } // Usage @Composable fun ParadeDemo() { ConfettiKit( modifier = Modifier.fillMaxSize(), parties = paradePreset() ) } ``` -------------------------------- ### Custom Party Configuration for Confetti Source: https://context7.com/vinceglb/confettikit/llms.txt Configure every aspect of confetti animation, including direction, speed, appearance, and lifecycle, using the `Party` data class. Sensible defaults are provided for most parameters. ```kotlin import io.github.vinceglb.confettikit.core.* import io.github.vinceglb.confettikit.core.emitter.Emitter import io.github.vinceglb.confettikit.core.models.Shape import io.github.vinceglb.confettikit.core.models.Size import kotlin.time.Duration.Companion.seconds // Fully customized party configuration val customParty = Party( // Direction: 0° = right, 90° = down, 180° = left, 270° = up angle = Angle.TOP, // Shoot upward (270°) spread = Spread.WIDE, // 100° spread pattern // Velocity control speed = 20f, // Base speed maxSpeed = 30f, // Random speed between 20-30 damping = 0.95f, // Speed decay rate (closer to 1 = slower decay) // Visual appearance colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), shapes = listOf(Shape.Square, Shape.Circle, Shape.Rectangle(0.5f)), size = listOf(Size.SMALL, Size.MEDIUM, Size.LARGE), // Lifecycle timeToLive = 3000L, // Particle lifetime in milliseconds fadeOutEnabled = true, // Fade out at end of life fadeOutDuration = 850L, // Fade out duration delay = 500, // Start after 500ms // Position: where particles spawn position = Position.Relative(0.5, 0.5), // Center of view // Rotation settings rotation = Rotation.enabled(), // Emission settings emitter = Emitter(duration = 5.seconds).perSecond(30) ) ``` -------------------------------- ### Configure Confetti Animation Lifecycle Source: https://github.com/vinceglb/confettikit/blob/main/README.md Control the timing and behavior of confetti particles using parameters like timeToLive, fadeOutEnabled, and delay. Position and rotation can also be configured. ```kotlin Party( timeToLive = 3000, // 3 seconds lifetime fadeOutEnabled = true, // Fade out at end delay = 500, // Start after 500ms position = Position.Relative(0.5, 0.5), rotation = Rotation.enabled() ) ``` -------------------------------- ### Configure Angle and Spread Source: https://context7.com/vinceglb/confettikit/llms.txt Sets the direction and width of the confetti spray using predefined constants or mathematical adjustments. ```kotlin import io.github.vinceglb.confettikit.core.Angle import io.github.vinceglb.confettikit.core.Spread import io.github.vinceglb.confettikit.core.Party import io.github.vinceglb.confettikit.core.emitter.Emitter import kotlin.time.Duration.Companion.seconds // Angle constants (in degrees) val shootUp = Angle.TOP // 270° val shootRight = Angle.RIGHT // 0° val shootDown = Angle.BOTTOM // 90° val shootLeft = Angle.LEFT // 180° // Custom angles using math val diagonalUpRight = Angle.TOP + 45 // 315° val diagonalUpLeft = Angle.TOP - 45 // 225° // Spread constants val narrowSpray = Spread.SMALL // 30° cone val wideSpray = Spread.WIDE // 100° cone val fullCircle = Spread.ROUND // 360° burst // Example: Upward fountain with narrow spread val fountainParty = Party( angle = Angle.TOP, spread = Spread.SMALL, speed = 25f, maxSpeed = 35f, emitter = Emitter(duration = 3.seconds).perSecond(40) ) ``` -------------------------------- ### Confetti Recipe: Explode Source: https://github.com/vinceglb/confettikit/blob/main/README.md Creates a burst of confetti that explodes from a single point with customizable speed, spread, colors, and emission. ```kotlin fun explode(): List { return listOf( Party( speed = 0f, maxSpeed = 30f, damping = 0.9f, spread = 360, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), emitter = Emitter(duration = 100.milliseconds).max(100), ) ) } ``` -------------------------------- ### Configure Confetti Particle Size Source: https://context7.com/vinceglb/confettikit/llms.txt Defines particle dimensions and mass to control gravity response and visual variety. ```kotlin import io.github.vinceglb.confettikit.core.Party import io.github.vinceglb.confettikit.core.models.Size import io.github.vinceglb.confettikit.core.emitter.Emitter import kotlin.time.Duration.Companion.seconds // Built-in size presets val smallSize = Size.SMALL // 6dp, mass 4f val mediumSize = Size.MEDIUM // 8dp, mass 5f val largeSize = Size.LARGE // 10dp, mass 6f // Custom size with specific mass (affects gravity response) val customSize = Size( sizeInDp = 12, // Size in density-independent pixels mass = 3f, // Lower mass = floats more massVariance = 0.3f // 30% variance for natural randomness ) // Light floating confetti val floatingSize = Size(sizeInDp = 8, mass = 2f, massVariance = 0.4f) // Heavy falling confetti val heavySize = Size(sizeInDp = 14, mass = 8f, massVariance = 0.1f) // Party with mixed sizes val mixedSizeParty = Party( size = listOf(Size.SMALL, Size.MEDIUM, Size.LARGE), emitter = Emitter(duration = 3.seconds).perSecond(30) ) ``` -------------------------------- ### Configure Particle Shapes Source: https://context7.com/vinceglb/confettikit/llms.txt Defines the visual appearance of particles using built-in primitives, custom Compose shapes, images, or vector graphics. ```kotlin import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.unit.dp import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Star import io.github.vinceglb.confettikit.core.Party import io.github.vinceglb.confettikit.core.models.Shape import io.github.vinceglb.confettikit.core.emitter.Emitter import kotlin.time.Duration.Companion.seconds // Built-in shapes val builtInShapes = listOf( Shape.Circle, Shape.Square, Shape.Rectangle(heightRatio = 0.3f) // Width > height ) // Custom Compose shapes val customShapes = listOf( Shape.CustomShape(CircleShape), Shape.CustomShape(RoundedCornerShape(8.dp)) ) // Image-based confetti (requires ImageBitmap) @Composable fun ImageConfetti(imageBitmap: ImageBitmap): List { return listOf(Shape.Image(imageBitmap)) } // Vector-based confetti @Composable fun VectorConfetti(): List { val starPainter = rememberVectorPainter(Icons.Outlined.Star) return listOf(Shape.Vector(starPainter)) } // Mixed shapes party val mixedShapesParty = Party( shapes = listOf( Shape.Circle, Shape.Square, Shape.CustomShape(RoundedCornerShape(4.dp)) ), emitter = Emitter(duration = 3.seconds).perSecond(50) ) ``` -------------------------------- ### ConfettiKit Composable for Animations Source: https://context7.com/vinceglb/confettikit/llms.txt Use the `ConfettiKit` composable to render confetti animations on a Canvas. Configure parties and handle animation lifecycle events. ```kotlin import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.* import androidx.compose.ui.Modifier import io.github.vinceglb.confettikit.compose.ConfettiKit import io.github.vinceglb.confettikit.core.Party import io.github.vinceglb.confettikit.core.emitter.Emitter import kotlin.time.Duration.Companion.seconds @Composable fun CelebrationScreen() { var showConfetti by remember { mutableStateOf(false) } if (showConfetti) { ConfettiKit( modifier = Modifier.fillMaxSize(), parties = listOf( Party(emitter = Emitter(duration = 5.seconds).perSecond(30)) ), onParticleSystemStarted = { system, activeSystems -> println("Animation started! Active systems: $activeSystems") }, onParticleSystemEnded = { system, activeSystems -> if (activeSystems == 0) { showConfetti = false println("All animations completed!") } } ) } } ``` -------------------------------- ### Create Custom Confetti Shapes Source: https://github.com/vinceglb/confettikit/blob/main/README.md Define a list of Party objects with custom shapes. Supports Compose shapes, images, and vector graphics. Ensure necessary imports for shapes and emitters. ```kotlin fun customShapes(): List { return listOf( Party( speed = 15f, maxSpeed = 25f, damping = 0.9f, spread = 360, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), shapes = listOf( // Custom Compose shapes Shape.CustomShape(RoundedCornerShape(8.dp)), Shape.CustomShape(CircleShape), // Images as confetti Shape.Image(imageBitmap), // Vector graphics Shape.Vector(vectorPainter) ), emitter = Emitter(duration = 3.seconds).perSecond(50), ) ) } ``` -------------------------------- ### Configure Confetti Rotation Source: https://context7.com/vinceglb/confettikit/llms.txt Controls 2D and 3D rotation effects for particles, including speed and variance settings. ```kotlin import io.github.vinceglb.confettikit.core.Rotation import io.github.vinceglb.confettikit.core.Party import io.github.vinceglb.confettikit.core.emitter.Emitter import kotlin.time.Duration.Companion.seconds // Enable rotation (default) val rotationEnabled = Rotation.enabled() // Disable rotation completely val rotationDisabled = Rotation.disabled() // Custom rotation settings val customRotation = Rotation( enabled = true, speed = 1.5f, // Base rotation speed variance = 0.5f, // Random variance (0-1) multiplier2D = 8f, // 2D rotation speed (0 to disable) multiplier3D = 1.5f // 3D flip effect speed ) // Fast spinning confetti val fastSpinRotation = Rotation( enabled = true, speed = 2.5f, multiplier2D = 12f, multiplier3D = 2f ) // Slow tumbling confetti val slowTumbleRotation = Rotation( enabled = true, speed = 0.5f, multiplier2D = 4f, multiplier3D = 0.8f ) // Party with custom rotation val spinningParty = Party( rotation = fastSpinRotation, emitter = Emitter(duration = 3.seconds).perSecond(30) ) ``` -------------------------------- ### Emitter Configuration for Particle Emission Source: https://context7.com/vinceglb/confettikit/llms.txt Control the number and duration of confetti particles using the `Emitter` class. Supports burst (max particles) and continuous (particles per second) modes. ```kotlin import io.github.vinceglb.confettikit.core.emitter.Emitter import kotlin.time.Duration.Companion.milliseconds import kotlin.time.Duration.Companion.seconds // Burst mode: Create 100 particles over 100ms (instant burst) val burstEmitter = Emitter(duration = 100.milliseconds).max(100) // Continuous mode: Create 30 particles per second for 5 seconds val continuousEmitter = Emitter(duration = 5.seconds).perSecond(30) // Short intense burst val intenseBurst = Emitter(duration = 200.milliseconds).max(200) // Long gentle stream val gentleStream = Emitter(duration = 10.seconds).perSecond(10) ``` -------------------------------- ### Confetti Recipe: Rain Source: https://github.com/vinceglb/confettikit/blob/main/README.md Creates a gentle rain effect with confetti falling from the top of the screen. Customizable for speed, spread, colors, emission, and spawn position. ```kotlin fun rain(): List { return listOf( Party( speed = 0f, maxSpeed = 15f, damping = 0.9f, angle = Angle.BOTTOM, spread = Spread.ROUND, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), emitter = Emitter(duration = 3.5.seconds).perSecond(100), position = Position.Relative(0.0, 0.0).between(Position.Relative(1.0, 0.0)) ) ) } ``` -------------------------------- ### Confetti Recipe: Parade Source: https://github.com/vinceglb/confettikit/blob/main/README.md Generates a parade effect where confetti moves across the screen from one side to the other. Supports configuring speed, spread, colors, and emission. ```kotlin fun parade(): List { val party = Party( speed = 10f, maxSpeed = 30f, damping = 0.9f, angle = Angle.RIGHT - 45, spread = Spread.SMALL, colors = listOf(0xfce18a, 0xff726d, 0xf4306d, 0xb48def), emitter = Emitter(duration = 5.seconds).perSecond(30), position = Position.Relative(0.0, 0.5) ) return listOf( party, party.copy( angle = party.angle - 90, // flip angle from right to left position = Position.Relative(1.0, 0.5) ), ) } ``` -------------------------------- ### Control Confetti Launch Direction Source: https://github.com/vinceglb/confettikit/blob/main/README.md Configure the launch angle and spread for confetti. Angle controls the direction (0° right, 90° up), and spread controls the spray pattern width (360° for a full burst). ```kotlin Party( angle = 90, // Straight up spread = 45, // 45-degree spread ) ``` -------------------------------- ### Customize Confetti Visuals Source: https://github.com/vinceglb/confettikit/blob/main/README.md Define the colors, shapes, and sizes of confetti particles. You can use predefined colors, shapes like squares and circles, and various sizes for a dynamic effect. ```kotlin Party( colors = listOf(0xfce18a, 0xff726d, 0xf4306d), shapes = listOf(Shape.Square, Shape.Circle), size = listOf(Size.SMALL, Size.MEDIUM) ) ``` -------------------------------- ### Add ConfettiKit Dependency Source: https://github.com/vinceglb/confettikit/blob/main/README.md Add the ConfettiKit dependency to your project's build file. Requires Kotlin 2.1.0 or higher. ```kotlin dependencies { implementation("io.github.vinceglb:confettikit:0.8.0") } ``` -------------------------------- ### Configure Confetti Emission Control Source: https://github.com/vinceglb/confettikit/blob/main/README.md Define how confetti pieces are emitted using the Emitter. Control the duration and rate (max per burst or per second). ```kotlin // Burst of 100 pieces over 100ms Emitter(duration = 100, TimeUnit.MILLISECONDS).max(100) ``` ```kotlin // Continuous stream of 30 pieces per second for 5 seconds Emitter(duration = 5, TimeUnit.SECONDS).perSecond(30) ``` -------------------------------- ### Integrate ConfettiKit with Jetpack Compose Source: https://github.com/vinceglb/confettikit/blob/main/README.md Use ConfettiKit as a Composable function within your Jetpack Compose UI. It accepts modifiers and callbacks for animation lifecycle events. ```kotlin ConfettiKit( modifier = Modifier.fillMaxSize(), parties = parties, onParticleSystemStarted = { system, activeSystems -> // Called when a party animation starts }, onParticleSystemEnded = { system, activeSystems -> // Called when a party animation ends } ) ``` -------------------------------- ### Control Confetti Velocity Source: https://github.com/vinceglb/confettikit/blob/main/README.md Adjust the speed, maximum speed, and damping of confetti particles. Speed sets the initial velocity, maxSpeed introduces variation, and damping controls how quickly the confetti slows down. ```kotlin Party( speed = 20f, // Base speed maxSpeed = 30f, // Maximum speed damping = 0.95f // Speed decay ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.