Particle Parameters

We saw already how to change the behavior of the emitter to change our simulation. The particle painter used allows us how the particle image is visualized for each particle.

Coming back to our example we update our ImageParticle. First, we change our particle image to a small sparking star image:

  1. ImageParticle {
  2. ...
  3. source: 'assets/star.png'
  4. }

The particle shall be colorized in an gold color which varies from particle to particle by +/- 20%:

  1. color: '#FFD700'
  2. colorVariation: 0.2

To make the scene more alive we would like to rotate the particles. Each particle should start by 15 degrees clockwise and varies between particles by +/-5 degrees. Additional the particle should continuously rotate with the velocity of 45 degrees per second. The velocity shall also vary from particle to particle by +/- 15 degrees per second:

  1. rotation: 15
  2. rotationVariation: 5
  3. rotationVelocity: 45
  4. rotationVelocityVariation: 15

Last but not least, we change the entry effect for the particle. This is the effect used when a particle comes to life. In this case, we want to use the scale effect:

  1. entryEffect: ImageParticle.Scale

So now we have rotating golden stars appearing all over the place.

image

Here is the code we changed for the image-particle in one block.

  1. ImageParticle {
  2. source: "assets/star.png"
  3. system: particleSystem
  4. color: '#FFD700'
  5. colorVariation: 0.2
  6. rotation: 0
  7. rotationVariation: 45
  8. rotationVelocity: 15
  9. rotationVelocityVariation: 15
  10. entryEffect: ImageParticle.Scale
  11. }