CanvasEmitterConfig

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

Parameters

particlePerSecond

is number of particles emitted by this source in 1sec. The emission happens every 100ms = 0,1s, so value less then 10 will be neglected.

emitterCenter

is DpOffset for the center of Emitter

startRegionShape

is the shape(path) for emitter. For example Point means every particle will be created at the same place emitterCenter

startRegionSize

is DpSize of region where emission happens. The source for each particle will be picked randomly from circumference of the startRegionShape

particleShapes
  • list of shapes for particles. The emitter will pick randomly from the list of available shapes

lifespanRange
  • duration of one particle. It is an IntRange to randomize the particle life

fadeOutTime
  • duration of fadeOut animation. Each particle can have random fadeOut time, so it is IntRange

scaleTime
  • duration of scaling animation. Use startScaleRange and targetScaleRange to control the parameters of particle scale

colors
  • a list of colors that each particle will randomly pick from

particleSizes
  • a list of sizes in DpSize for each particle. It will be picked randomly from available sizes. The size can be also manipulated using startScaleRange and targetScaleRange

spread
  • range of angles (in degrees) that describe the direction of path for each particle. 0 degrees points upward (top of the screen)

blendMode
alphaEasing
  • an easing curve that is applied for alpha animation on each particle

scaleEasing
  • an easing curve that is applied for scale animation on each particle

initialForce
  • initial velocity magnitude for each particle. Higher values make particles move faster from the emission point. The value is picked randomly from the provided range.

rotationRange
  • range of angles (in degrees) that each particle will rotate during translation

targetScaleRange
  • end scale for each particle

startScaleRange
  • start scale for each particle

gravityStrength
  • strength of gravitational force applied to particles in Dp/s². A value of 0 means no gravity. Higher values create stronger pull.

gravityAngle
  • direction of gravity in degrees. 0 degrees points downward (bottom of the screen), 90 degrees points left, -90 degrees points right, 180 degrees points upward.

edgeBehavior
hideInStartRegion
  • when true, particles whose current position falls inside the start region (as defined by startRegionShape and startRegionSize) are not drawn. Useful for ring emitters with 360° spread where particles crossing the interior would otherwise clutter the center. Default is false.