Qt 5.13 | Qt Quick | QML Types | Emitter QML Type

Qt 5.13.2 Reference Documentation

# Emitter QML Type

Emits logical particles. More...

Import Statement: | import QtQuick.Particles 2.13

- List of all members, including inherited members

## Properties

- acceleration : StochasticDirection
- emitRate : real
- enabled : bool
- endSize : real
- group : string
- lifeSpan : int
- lifeSpanVariation : int
- maximumEmitted : int
- shape : Shape
- size : real
- sizeVariation : real
- startTime : int
- system : ParticleSystem
- velocity : StochasticDirection
- velocityFromMovement : qreal

## Signals

- emitParticles(particles)

## Methods

- burst(count, int x, int y)
- burst(count)
- pulse(duration)

## Detailed Description

This element emits logical particles into the ParticleSystem, with the given starting attributes.

Note that logical particles are not automatically rendered, you will need to have one or more ParticlePainter elements visualizing them.

Note that the given starting attributes can be modified at any point in the particle's lifetime by any Affector element in the same ParticleSystem. This includes attributes like lifespan.

## Property Documentation

acceleration : StochasticDirection

The starting acceleraton of the particles emitted.

emitRate : real

Number of particles emitted per second.

Default value is 10 particles per second.

enabled : bool

If set to false, the emitter will cease emissions until it is set to true.

Default value is true.

endSize : real

The size in pixels of the particles at the end of their life. Size will be linearly interpolated during the life of the particle from this value and size. If endSize is -1, then the size of the particle will remain constant at the starting size.

Default value is -1.

group : string

This is the logical particle group which it will emit into.

Default value is "" (empty string).

lifeSpan : int

The time in milliseconds each emitted particle should last for.

If you do not want particles to automatically die after a time, for example if you wish to dispose of them manually, set lifeSpan to Emitter.InfiniteLife.

lifeSpans greater than or equal to 600000 (10 minutes) will be treated as infinite. Particles with lifeSpans less than or equal to 0 will start out dead.

Default value is 1000 (one second).

lifeSpanVariation : int

Particle lifespans will vary by up to this much in either direction.

Default value is 0.

maximumEmitted : int

The maximum number of particles at a time that this emitter will have alive.

This can be set as a performance optimization (when using burst and pulse) or to stagger emissions.

If this is set to a number below zero, then there is no maximum limit on the number of particles this emitter can have alive.

The default value is -1.

shape : Shape

This shape is applied with the size of the Emitter. Particles will be emitted randomly from any area covered by the shape.

The default shape is a filled in rectangle, which corresponds to the full bounding box of the Emitter.

size : real

The size in pixels of the particles at the start of their life.

Default value is 16.

sizeVariation : real

The size of a particle can vary by this much up or down from size/endSize. The same random addition is made to both size and endSize for a single particle.

Default value is 0.

startTime : int

If this value is set when the emitter is loaded, then it will emit particles from the past, up to startTime milliseconds ago. These will simulate as if they were emitted then, but will not have any affectors applied to them. Affectors will take effect from the present time.

system : ParticleSystem

This is the Particle system that the Emitter will emit into. This can be omitted if the Emitter is a direct child of the ParticleSystem

velocity : StochasticDirection

The starting velocity of the particles emitted.

velocityFromMovement : qreal

If this value is non-zero, then any movement of the emitter will provide additional starting velocity to the particles based on the movement. The additional vector will be the same angle as the emitter's movement, with a magnitude that is the magnitude of the emitters movement multiplied by velocityFromMovement.

Default value is 0.

## Signal Documentation

emitParticles(particles)

This signal is emitted when particles are emitted. particles is a JavaScript array of Particle objects. You can modify particle attributes directly within the handler.

Note: JavaScript is slower to execute, so it is not recommended to use this in high-volume particle systems.

The corresponding handler is `onEmitParticles`.

## Method Documentation

burst(count, int x, int y)

Emits a number of particles, specified by count, from this emitter immediately. The particles are emitted as if the Emitter was positioned at (x, y) but all other properties are the same.

burst(count)

Emits a number of particles, specified by count, from this emitter immediately.

pulse(duration)

If the emitter is not enabled, enables it for a specified duration (in milliseconds) and then switches it back off.