particle.d.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import type { Nullable } from "../types";
  2. import { Vector2, Vector3, Vector4 } from "../Maths/math.vector";
  3. import { Color4 } from "../Maths/math.color";
  4. import type { SubEmitter } from "./subEmitter";
  5. import type { ColorGradient, FactorGradient } from "../Misc/gradients";
  6. import type { ThinParticleSystem } from "./thinParticleSystem";
  7. /**
  8. * A particle represents one of the element emitted by a particle system.
  9. * This is mainly define by its coordinates, direction, velocity and age.
  10. */
  11. export declare class Particle {
  12. /**
  13. * The particle system the particle belongs to.
  14. */
  15. particleSystem: ThinParticleSystem;
  16. private static _Count;
  17. /**
  18. * Unique ID of the particle
  19. */
  20. id: number;
  21. /**
  22. * The world position of the particle in the scene.
  23. */
  24. position: Vector3;
  25. /**
  26. * The world direction of the particle in the scene.
  27. */
  28. direction: Vector3;
  29. /**
  30. * The color of the particle.
  31. */
  32. color: Color4;
  33. /**
  34. * The color change of the particle per step.
  35. */
  36. colorStep: Color4;
  37. /**
  38. * Defines how long will the life of the particle be.
  39. */
  40. lifeTime: number;
  41. /**
  42. * The current age of the particle.
  43. */
  44. age: number;
  45. /**
  46. * The current size of the particle.
  47. */
  48. size: number;
  49. /**
  50. * The current scale of the particle.
  51. */
  52. scale: Vector2;
  53. /**
  54. * The current angle of the particle.
  55. */
  56. angle: number;
  57. /**
  58. * Defines how fast is the angle changing.
  59. */
  60. angularSpeed: number;
  61. /**
  62. * Defines the cell index used by the particle to be rendered from a sprite.
  63. */
  64. cellIndex: number;
  65. /**
  66. * The information required to support color remapping
  67. */
  68. remapData: Vector4;
  69. /** @internal */
  70. _randomCellOffset?: number;
  71. /** @internal */
  72. _initialDirection: Nullable<Vector3>;
  73. /** @internal */
  74. _attachedSubEmitters: Nullable<Array<SubEmitter>>;
  75. /** @internal */
  76. _initialStartSpriteCellID: number;
  77. /** @internal */
  78. _initialEndSpriteCellID: number;
  79. /** @internal */
  80. _initialSpriteCellLoop: boolean;
  81. /** @internal */
  82. _currentColorGradient: Nullable<ColorGradient>;
  83. /** @internal */
  84. _currentColor1: Color4;
  85. /** @internal */
  86. _currentColor2: Color4;
  87. /** @internal */
  88. _currentSizeGradient: Nullable<FactorGradient>;
  89. /** @internal */
  90. _currentSize1: number;
  91. /** @internal */
  92. _currentSize2: number;
  93. /** @internal */
  94. _currentAngularSpeedGradient: Nullable<FactorGradient>;
  95. /** @internal */
  96. _currentAngularSpeed1: number;
  97. /** @internal */
  98. _currentAngularSpeed2: number;
  99. /** @internal */
  100. _currentVelocityGradient: Nullable<FactorGradient>;
  101. /** @internal */
  102. _currentVelocity1: number;
  103. /** @internal */
  104. _currentVelocity2: number;
  105. /** @internal */
  106. _currentLimitVelocityGradient: Nullable<FactorGradient>;
  107. /** @internal */
  108. _currentLimitVelocity1: number;
  109. /** @internal */
  110. _currentLimitVelocity2: number;
  111. /** @internal */
  112. _currentDragGradient: Nullable<FactorGradient>;
  113. /** @internal */
  114. _currentDrag1: number;
  115. /** @internal */
  116. _currentDrag2: number;
  117. /** @internal */
  118. _randomNoiseCoordinates1: Vector3;
  119. /** @internal */
  120. _randomNoiseCoordinates2: Vector3;
  121. /** @internal */
  122. _localPosition?: Vector3;
  123. /**
  124. * Creates a new instance Particle
  125. * @param particleSystem the particle system the particle belongs to
  126. */
  127. constructor(
  128. /**
  129. * The particle system the particle belongs to.
  130. */
  131. particleSystem: ThinParticleSystem);
  132. private _updateCellInfoFromSystem;
  133. /**
  134. * Defines how the sprite cell index is updated for the particle
  135. */
  136. updateCellIndex(): void;
  137. /**
  138. * @internal
  139. */
  140. _inheritParticleInfoToSubEmitter(subEmitter: SubEmitter): void;
  141. /** @internal */
  142. _inheritParticleInfoToSubEmitters(): void;
  143. /** @internal */
  144. _reset(): void;
  145. /**
  146. * Copy the properties of particle to another one.
  147. * @param other the particle to copy the information to.
  148. */
  149. copyTo(other: Particle): void;
  150. }