在本页

Emitter QML Type

发射逻辑粒子。更多

Import Statement: import QtQuick.Particles
Inherited By:

TrailEmitter

属性

信号

方法

  • void burst(int count)
  • void burst(int count, int x, int y)
  • void pulse(int duration)

详细说明

该元素以给定的起始属性向ParticleSystem 发射逻辑粒子。

请注意,逻辑粒子不会自动渲染,您需要一个或多个ParticlePainter 元素将其可视化。

请注意,给定的起始属性可在粒子生命周期的任何时刻由同一ParticleSystem 中的任何 Affector 元素修改。这包括生命周期等属性。

属性文档

acceleration : StochasticDirection

发射粒子的起始加速度。

emitRate : real

每秒发射的粒子数。

默认值为每秒 10 个粒子。

enabled : bool

如果设置为 false,发射器将停止发射,直到设置为 true。

默认值为 true。

endSize : real

粒子寿命结束时的尺寸(像素)。在粒子的生命周期内,尺寸将根据此值和尺寸进行线性插值。如果 endSize 为-1,那么粒子的尺寸将保持在起始尺寸不变。

默认值为-1。

group : string

这是它将发射到的逻辑粒子群。

默认值为""(空字符串)。

lifeSpan : int

每个发射的粒子应持续的时间(毫秒)。

如果您不想让粒子在一段时间后自动死亡,例如您想手动处理它们,请将 lifeSpan 设置为 Emitter.InfiniteLife。

大于或等于 600000(10 分钟)的寿命将被视为无限寿命。寿命小于或等于 0 的粒子一开始就会死亡。

默认值为 1000(一秒)。

lifeSpanVariation : int

粒子的寿命在任一方向上的变化都会达到这个数值。

默认值为 0。

maximumEmitted : int

该发射器每次存活粒子的最大数量。

可以将其设置为性能优化(使用突发和脉冲时)或错开发射。

如果设置为零以下的数值,则对该发射器的存活粒子数量没有最大限制。

默认值为-1。

shape : Shape

该形状与发射器的大小一起应用。粒子将从形状覆盖的任何区域随机发射。

默认形状是一个填充矩形,相当于发射器的整个边界框。

size : real

粒子开始运行时的大小(像素)。

默认值为 16。

sizeVariation : real

一个粒子的大小与尺寸/endSize 之间的上下浮动可以相差这么多。单个粒子的大小和endSize 都会有相同的随机加法。

默认值为 0。

startTime : int

如果在加载发射器时设置了该值,那么它将发射过去的粒子,直到 startTime 毫秒之前。这些粒子将模拟为当时发射的粒子,但不会应用任何影响因子。影响因子将从现在开始生效。

system : ParticleSystem

这是发射器要发射的粒子系统。如果发射器是ParticleSystem

velocity : StochasticDirection

发射粒子的起始速度。

velocityFromMovement : real

如果该值不为零,则发射器的任何移动都将根据移动情况为粒子提供额外的起始速度。附加矢量的角度与发射器移动的角度相同,大小为发射器移动的大小乘以 velocityFromMovement。

默认值为 0。

信号文档

emitParticles(Array particles)

particles 是一个包含粒子对象的 JavaScript 数组。您可以直接在处理程序中修改粒子属性。

注意: JavaScript 的执行速度较慢,因此不建议在大容量粒子系统中使用。

注: 相应的处理程序是onEmitParticles

方法文档

void burst(int count)

立即从该发射器发射一定数量的粒子,具体数量由count 指定。

void burst(int count, int x, int y)

立即从该发射器发射由count 指定数量的粒子。粒子的发射方式与发射器的位置(x,y )相同,但所有其他属性都相同。

void pulse(int duration)

如果发射器未启用,则在指定的duration (毫秒)内启用发射器,然后将其关闭。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.