emitRatePerParticle: 120
lifeSpan: 180
- emitWidth: 8
- emitHeight: 8
+ emitWidth: TrailEmitter.ParticleSize
+ emitHeight: TrailEmitter.ParticleSize
+ emitShape: EllipseShape{}
size: 16
sizeVariation: 4
emitRatePerParticle: 128
lifeSpan: 2400
- emitWidth: 16
- emitHeight: 16
+ emitWidth: TrailEmitter.ParticleSize
+ emitHeight: TrailEmitter.ParticleSize
+ emitShape: EllipseShape{}
speed: PointDirection {yVariation: 16; xVariation: 16}
acceleration: PointDirection {y: -16}
speed: PointDirection {y:-17*4*2; xVariation: 6*6}
acceleration: PointDirection {y: 17*2; xVariation: 6*6}
- size: 12
+ size: 8
sizeVariation: 4
}
\qmlproperty Shape QtQuick.Particles2::TrailEmitter::emitShape
As the area of a TrailEmitter is the area it follows, a separate shape can be provided
- to be the shape it emits out of.
+ to be the shape it emits out of. This shape has width and height specified by emitWidth
+ and emitHeight, and is centered on the followed particle's position.
+
+ The default shape is a filled Rectangle.
*/
/*!
\qmlproperty real QtQuick.Particles2::TrailEmitter::emitWidth
+
+ The width in pixels the emitShape is scaled to. If set to TrailEmitter.ParticleSize,
+ the width will be the current size of the particle being followed.
+
+ Default is 0.
*/
/*!
\qmlproperty real QtQuick.Particles2::TrailEmitter::emitHeight
+
+ The height in pixels the emitShape is scaled to. If set to TrailEmitter.ParticleSize,
+ the height will be the current size of the particle being followed.
+
+ Default is 0.
*/
/*!
\qmlproperty real QtQuick.Particles2::TrailEmitter::emitRatePerParticle
// Note that burst location doesn't get used for follow emitter
qreal followT = pt - d->t;
qreal followT2 = followT * followT * 0.5;
- //qreal sizeOffset = d->size/2;//TODO: Current size? As an option
- //TODO: Set variations
+ qreal eW = m_emitterXVariation < 0 ? d->curSize() : m_emitterXVariation;
+ qreal eH = m_emitterYVariation < 0 ? d->curSize() : m_emitterYVariation;
//Subtract offset, because PS expects this in emitter coordinates
- QRectF boundsRect(d->x - offset.x() + d->vx * followT + d->ax * followT2 - m_emitterXVariation/2,
- d->y - offset.y() + d->vy * followT + d->ay * followT2 - m_emitterYVariation/2,
- m_emitterXVariation,
- m_emitterYVariation);
- // QRectF boundsRect(d->x + d->vx * followT + d->ax * followT2 + offset.x() - sizeOffset,
- // d->y + d->vy * followT + d->ay * followT2 + offset.y() - sizeOffset,
- // sizeOffset*2,
- // sizeOffset*2);
+ QRectF boundsRect(d->x - offset.x() + d->vx * followT + d->ax * followT2 - eW/2,
+ d->y - offset.y() + d->vy * followT + d->ay * followT2 - eH/2,
+ eW, eH);
QSGParticleExtruder* effectiveEmissionExtruder = m_emissionExtruder ? m_emissionExtruder : m_defaultEmissionExtruder;
const QPointF &newPos = effectiveEmissionExtruder->extrude(boundsRect);
Q_PROPERTY(QString follow READ follow WRITE setFollow NOTIFY followChanged)
Q_PROPERTY(int emitRatePerParticle READ particlesPerParticlePerSecond WRITE setParticlesPerParticlePerSecond NOTIFY particlesPerParticlePerSecondChanged)
- //TODO: Document that TrailEmitter's box is where it follows. It emits in a rect centered on the followed particle
- //TODO: A set of properties that can involve the particle size of the followed
Q_PROPERTY(QSGParticleExtruder* emitShape READ emissonShape WRITE setEmissionShape NOTIFY emissionShapeChanged)
Q_PROPERTY(qreal emitHeight READ emitterYVariation WRITE setEmitterYVariation NOTIFY emitterYVariationChanged)
Q_PROPERTY(qreal emitWidth READ emitterXVariation WRITE setEmitterXVariation NOTIFY emitterXVariationChanged)
+ Q_ENUMS(EmitSize)
public:
+ enum EmitSize {
+ ParticleSize = -2//Anything less than 0 will do
+ };
explicit QSGTrailEmitter(QSGItem *parent = 0);
virtual void emitWindow(int timeStamp);
virtual void reset();