ParticleBurst.js 1.5 KB

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