Package-level declarations

Public API of the library: the two emitter composables (CanvasParticleEmitter, ParticlesEmitter), the MultiEmitter orchestrator, their configuration types (CanvasEmitterConfig, EmitterConfig), and the supporting value types ParticleShape and EdgeBehavior.

Types

Link copied to clipboard
data class CanvasEmitterConfig(val particlePerSecond: Int, val emitterCenter: DpOffset, val startRegionShape: CanvasEmitterConfig.Shape, val startRegionSize: DpSize, val particleShapes: List<ParticleShape>, val lifespanRange: IntRange, val fadeOutTime: IntRange, val scaleTime: IntRange, val colors: List<Color>, val particleSizes: List<DpSize>, val spread: IntRange = IntRange(-180, 180), val blendMode: BlendMode = BlendMode.SrcOver, val alphaEasing: Easing = LinearEasing, val scaleEasing: Easing = LinearEasing, val initialForce: IntRange = IntRange(10, 100), val rotationRange: IntRange = IntRange(-180, 180), val startScaleRange: IntRange = IntRange(0,1), val targetScaleRange: IntRange = IntRange(1,2), val gravityStrength: Float = 0.0f, val gravityAngle: Int = 0, val edgeBehavior: EdgeBehavior = EdgeBehavior.None, val hideInStartRegion: Boolean = false)

Configuration for CanvasParticleEmitter — describes how many particles to emit, where and in what shape they originate, how they look, and the physics that governs their motion.

Link copied to clipboard
sealed class EdgeBehavior

Defines how particles behave when they reach the boundary of the emitter's composable.

Link copied to clipboard
data class EmitterConfig(val id: String = "", val particlesCount: Int = 10, val emitDurationMillis: Long = 0, val particleLifespanMillis: Long = 2000, val initialForce: Int = 100, val gravityStrength: Float = 1.0f, val gravityAngle: Int = 0, val spread: IntRange = IntRange(-180, 180), val maxHorizontalDisplacementDp: Int = 2000, val rotationMultiplier: Float = 1.0f, val randomStartPoint: Boolean = true, val particle: @Composable () -> Unit)

Configuration for ParticlesEmitter (and, in turn, MultiEmitter) — the layout-based emitter whose particles are arbitrary @Composable content supplied via particle.

Link copied to clipboard
sealed interface ParticleShape

How a particle is drawn by CanvasParticleEmitter.

Functions

Link copied to clipboard

A high-performance, Canvas-based particle emitter.

Link copied to clipboard
fun MultiEmitter(modifier: Modifier, emitterCount: Int, emitterDelay: Long, emitterConfig: EmitterConfig, onAnimationFinished: () -> Unit = {})

Orchestrates several ParticlesEmitter runs from a shared EmitterConfig, launched one after another with a fixed delay between them.

Link copied to clipboard
fun ParticlesEmitter(modifier: Modifier = Modifier, config: EmitterConfig, onAnimationFinished: () -> Unit)

A Compose layout-based particle emitter whose particles are arbitrary @Composable content.