x: ma.mouseX
y: ma.mouseY
emitRate: 16000
- lifeSpan: 1000
emitCap: 4000
acceleration: AngledDirection{angleVariation: 360; magnitude: 360; }
size: 8
MouseArea{
width: 100
height: 100
- onClicked: sys.overwrite = !sys.overwrite
+ onClicked: bursty.noCap = true;
id: ma2
Rectangle{
anchors.fill: parent
}
}
+ //TODO: Implement startTime and speedFromMovement
qreal time = timeStamp / 1000.;
qreal particleRatio = 1. / m_particlesPerParticlePerSecond;
qreal pt;
continue;
}
while (pt < time || !m_burstQueue.isEmpty()){
- QSGParticleData* datum = m_system->newDatum(gId2);
+ QSGParticleData* datum = m_system->newDatum(gId2, !m_overwrite);
if (datum){//else, skip this emission
datum->e = this;//###useful?
Default value is 0.
*/
+
/*!
\qmlproperty int QtQuick.Particles2::Emitter::emitCap
is the number of particles that would be alive at any one time given the default settings.
*/
/*!
+ \qmlproperty bool QtQuick.Particles2::Emitter::noCap
+
+ If set to true, the emitCap will be ignored and this emitter will never skip emitting
+ a particle based on how many it has alive.
+
+ Default value is false.
+*/
+/*!
+ \qmlproperty int QtQuick.Particles2::Emitter::startTime
+
+ 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.
+*/
+/*!
\qmlproperty real QtQuick.Particles2::Emitter::size
The size in pixels of the particles at the start of their life.
, m_speed_from_movement(0)
, m_particle_count(0)
, m_reset_last(true)
- , m_last_timestamp(0)
+ , m_last_timestamp(-1)
, m_last_emission(0)
+ , m_startTime(0)
+ , m_overwrite(false)
{
//TODO: Reset speed/acc back to null vector? Or allow null pointer?
if (m_reset_last) {
m_last_emitter = m_last_last_emitter = QPointF(x(), y());
- m_last_timestamp = timeStamp/1000.;
+ if (m_last_timestamp == -1)
+ m_last_timestamp = timeStamp/1000. - m_startTime;
+ else
+ m_last_timestamp = timeStamp/1000.;
m_last_emission = m_last_timestamp;
m_reset_last = false;
}
pt = time;
while (pt < time || !m_burstQueue.isEmpty()) {
//int pos = m_last_particle % m_particle_count;
- QSGParticleData* datum = m_system->newDatum(m_system->m_groupIds[m_particle]);
+ QSGParticleData* datum = m_system->newDatum(m_system->m_groupIds[m_particle], !m_overwrite);
if (datum){//actually emit(otherwise we've been asked to skip this one)
datum->e = this;//###useful?
qreal t = 1 - (pt - opt) / dt;
Q_PROPERTY(QString particle READ particle WRITE setParticle NOTIFY particleChanged)
Q_PROPERTY(QSGParticleExtruder* shape READ extruder WRITE setExtruder NOTIFY extruderChanged)
Q_PROPERTY(bool emitting READ emitting WRITE setEmitting NOTIFY emittingChanged)
+ Q_PROPERTY(int startTime READ startTime WRITE setStartTime NOTIFY startTimeChanged)
+ Q_PROPERTY(bool noCap READ overwrite WRITE setOverWrite NOTIFY overwriteChanged)
Q_PROPERTY(qreal emitRate READ particlesPerSecond WRITE setParticlesPerSecond NOTIFY particlesPerSecondChanged)
Q_PROPERTY(int lifeSpan READ particleDuration WRITE setParticleDuration NOTIFY particleDurationChanged)
void speedFromMovementChanged();
+ void startTimeChanged(int arg);
+
+ void overwriteChanged(bool arg);
+
public slots:
void pulse(qreal seconds);
void burst(int num);
void setMaxParticleCount(int arg);
+ void setStartTime(int arg)
+ {
+ if (m_startTime != arg) {
+ m_startTime = arg;
+ emit startTimeChanged(arg);
+ }
+ }
+
+ void setOverWrite(bool arg)
+{
+ if (m_overwrite != arg) {
+ m_overwrite = arg;
+emit overwriteChanged(arg);
+}
+}
+
public:
int particleCount() const;
return m_maxParticleCount;
}
+ int startTime() const
+ {
+ return m_startTime;
+ }
+
+ bool overwrite() const
+ {
+ return m_overwrite;
+ }
+
protected:
qreal m_particlesPerSecond;
int m_particleDuration;
qreal m_particleEndSize;
qreal m_particleSizeVariation;
+ qreal m_speedFromMovement;
+ int m_startTime;
+ bool m_overwrite;
+
int m_burstLeft;//TODO: Rename to pulse
QList<QPair<int, QPointF > > m_burstQueue;
int m_maxParticleCount;
private:
QSGStochasticDirection m_nullVector;
- qreal m_speedFromMovement;
+
};
QT_END_NAMESPACE