ParticleBurst.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import defaultValue from '../Core/defaultValue.js';
  2. import defineProperties from '../Core/defineProperties.js';
  3. /**
  4. * Represents a burst of {@link Particle}s from a {@link ParticleSystem} at a given time in the systems lifetime.
  5. *
  6. * @alias ParticleBurst
  7. * @constructor
  8. *
  9. * @param {Object} [options] An object with the following properties:
  10. * @param {Number} [options.time=0.0] The time in seconds after the beginning of the particle system's lifetime that the burst will occur.
  11. * @param {Number} [options.minimum=0.0] The minimum number of particles emmitted in the burst.
  12. * @param {Number} [options.maximum=50.0] The maximum number of particles emitted in the burst.
  13. */
  14. function ParticleBurst(options) {
  15. options = defaultValue(options, defaultValue.EMPTY_OBJECT);
  16. /**
  17. * The time in seconds after the beginning of the particle system's lifetime that the burst will occur.
  18. * @type {Number}
  19. * @default 0.0
  20. */
  21. this.time = defaultValue(options.time, 0.0);
  22. /**
  23. * The minimum number of particles emitted.
  24. * @type {Number}
  25. * @default 0.0
  26. */
  27. this.minimum = defaultValue(options.minimum, 0.0);
  28. /**
  29. * The maximum number of particles emitted.
  30. * @type {Number}
  31. * @default 50.0
  32. */
  33. this.maximum = defaultValue(options.maximum, 50.0);
  34. this._complete = false;
  35. }
  36. defineProperties(ParticleBurst.prototype, {
  37. /**
  38. * <code>true</code> if the burst has been completed; <code>false</code> otherwise.
  39. * @memberof ParticleBurst.prototype
  40. * @type {Boolean}
  41. */
  42. complete : {
  43. get : function() {
  44. return this._complete;
  45. }
  46. }
  47. });
  48. export default ParticleBurst;