Use particle groups to separate effects

This commit is contained in:
Loren Burkholder 2023-03-24 08:50:44 -04:00
parent 44d4e6f9b5
commit c751c487da

View file

@ -365,7 +365,7 @@ Item {
} }
ParticleSystem { ParticleSystem {
id: confettiParticleSystem id: particleSystem
Component.onCompleted: pause(); Component.onCompleted: pause();
paused: !shouldEffectsRun paused: !shouldEffectsRun
@ -374,13 +374,14 @@ Item {
Emitter { Emitter {
id: confettiEmitter id: confettiEmitter
group: "confetti"
width: parent.width * 3/4 width: parent.width * 3/4
enabled: false enabled: false
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
y: parent.height y: parent.height
emitRate: Math.min(400 * Math.sqrt(parent.width * parent.height) / 870, 1000) emitRate: Math.min(400 * Math.sqrt(parent.width * parent.height) / 870, 1000)
lifeSpan: 15000 lifeSpan: 15000
system: confettiParticleSystem system: particleSystem
maximumEmitted: 500 maximumEmitted: 500
velocityFromMovement: 8 velocityFromMovement: 8
size: 16 size: 16
@ -394,7 +395,8 @@ Item {
} }
ImageParticle { ImageParticle {
system: confettiParticleSystem system: particleSystem
groups: ["confetti"]
source: "qrc:/confettiparticle.svg" source: "qrc:/confettiparticle.svg"
rotationVelocity: 0 rotationVelocity: 0
rotationVelocityVariation: 360 rotationVelocityVariation: 360
@ -416,29 +418,23 @@ Item {
} }
Gravity { Gravity {
system: confettiParticleSystem system: particleSystem
anchors.fill: parent anchors.fill: parent
magnitude: 350 magnitude: 350
angle: 90 angle: 90
} }
ParticleSystem {
id: rainfallParticleSystem
Component.onCompleted: pause();
paused: !shouldEffectsRun
}
Emitter { Emitter {
id: rainfallEmitter id: rainfallEmitter
group: "rain"
width: parent.width width: parent.width
enabled: false enabled: false
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
y: -60 y: -60
emitRate: parent.width / 50 emitRate: parent.width / 50
lifeSpan: 10000 lifeSpan: 10000
system: rainfallParticleSystem system: particleSystem
velocity: PointDirection { velocity: PointDirection {
x: 0 x: 0
y: 300 y: 300
@ -447,7 +443,8 @@ Item {
} }
ItemParticle { ItemParticle {
system: rainfallParticleSystem system: particleSystem
groups: ["rain"]
fade: false fade: false
delegate: Rectangle { delegate: Rectangle {
width: 2 width: 2