runtimeAnimation.d.ts 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. import type { _IAnimationState } from "./animation";
  2. import { Animation } from "./animation";
  3. import type { Animatable } from "./animatable";
  4. import type { Scene } from "../scene";
  5. /**
  6. * Defines a runtime animation
  7. */
  8. export declare class RuntimeAnimation {
  9. private _events;
  10. /**
  11. * The current frame of the runtime animation
  12. */
  13. private _currentFrame;
  14. /**
  15. * The animation used by the runtime animation
  16. */
  17. private _animation;
  18. /**
  19. * The target of the runtime animation
  20. */
  21. private _target;
  22. /**
  23. * The initiating animatable
  24. */
  25. private _host;
  26. /**
  27. * The original value of the runtime animation
  28. */
  29. private _originalValue;
  30. /**
  31. * The original blend value of the runtime animation
  32. */
  33. private _originalBlendValue;
  34. /**
  35. * The offsets cache of the runtime animation
  36. */
  37. private _offsetsCache;
  38. /**
  39. * The high limits cache of the runtime animation
  40. */
  41. private _highLimitsCache;
  42. /**
  43. * Specifies if the runtime animation has been stopped
  44. */
  45. private _stopped;
  46. /**
  47. * The blending factor of the runtime animation
  48. */
  49. private _blendingFactor;
  50. /**
  51. * The BabylonJS scene
  52. */
  53. private _scene;
  54. /**
  55. * The current value of the runtime animation
  56. */
  57. private _currentValue;
  58. /** @internal */
  59. _animationState: _IAnimationState;
  60. /**
  61. * The active target of the runtime animation
  62. */
  63. private _activeTargets;
  64. private _currentActiveTarget;
  65. private _directTarget;
  66. /**
  67. * The target path of the runtime animation
  68. */
  69. private _targetPath;
  70. /**
  71. * The weight of the runtime animation
  72. */
  73. private _weight;
  74. /**
  75. * The absolute frame offset of the runtime animation
  76. */
  77. private _absoluteFrameOffset;
  78. /**
  79. * The previous elapsed time (since start of animation) of the runtime animation
  80. */
  81. private _previousElapsedTime;
  82. private _yoyoDirection;
  83. /**
  84. * The previous absolute frame of the runtime animation (meaning, without taking into account the from/to values, only the elapsed time and the fps)
  85. */
  86. private _previousAbsoluteFrame;
  87. private _enableBlending;
  88. private _keys;
  89. private _minFrame;
  90. private _maxFrame;
  91. private _minValue;
  92. private _maxValue;
  93. private _targetIsArray;
  94. /**
  95. * Gets the current frame of the runtime animation
  96. */
  97. get currentFrame(): number;
  98. /**
  99. * Gets the weight of the runtime animation
  100. */
  101. get weight(): number;
  102. /**
  103. * Gets the current value of the runtime animation
  104. */
  105. get currentValue(): any;
  106. /**
  107. * Gets or sets the target path of the runtime animation
  108. */
  109. get targetPath(): string;
  110. /**
  111. * Gets the actual target of the runtime animation
  112. */
  113. get target(): any;
  114. /**
  115. * Gets the additive state of the runtime animation
  116. */
  117. get isAdditive(): boolean;
  118. /** @internal */
  119. _onLoop: () => void;
  120. /**
  121. * Create a new RuntimeAnimation object
  122. * @param target defines the target of the animation
  123. * @param animation defines the source animation object
  124. * @param scene defines the hosting scene
  125. * @param host defines the initiating Animatable
  126. */
  127. constructor(target: any, animation: Animation, scene: Scene, host: Animatable);
  128. private _preparePath;
  129. /**
  130. * Gets the animation from the runtime animation
  131. */
  132. get animation(): Animation;
  133. /**
  134. * Resets the runtime animation to the beginning
  135. * @param restoreOriginal defines whether to restore the target property to the original value
  136. */
  137. reset(restoreOriginal?: boolean): void;
  138. /**
  139. * Specifies if the runtime animation is stopped
  140. * @returns Boolean specifying if the runtime animation is stopped
  141. */
  142. isStopped(): boolean;
  143. /**
  144. * Disposes of the runtime animation
  145. */
  146. dispose(): void;
  147. /**
  148. * Apply the interpolated value to the target
  149. * @param currentValue defines the value computed by the animation
  150. * @param weight defines the weight to apply to this value (Defaults to 1.0)
  151. */
  152. setValue(currentValue: any, weight: number): void;
  153. private _getOriginalValues;
  154. private _setValue;
  155. /**
  156. * Gets the loop pmode of the runtime animation
  157. * @returns Loop Mode
  158. */
  159. private _getCorrectLoopMode;
  160. /**
  161. * Move the current animation to a given frame
  162. * @param frame defines the frame to move to
  163. */
  164. goToFrame(frame: number): void;
  165. /**
  166. * @internal Internal use only
  167. */
  168. _prepareForSpeedRatioChange(newSpeedRatio: number): void;
  169. /**
  170. * Execute the current animation
  171. * @param elapsedTimeSinceAnimationStart defines the elapsed time (in milliseconds) since the animation was started
  172. * @param from defines the lower frame of the animation range
  173. * @param to defines the upper frame of the animation range
  174. * @param loop defines if the current animation must loop
  175. * @param speedRatio defines the current speed ratio
  176. * @param weight defines the weight of the animation (default is -1 so no weight)
  177. * @returns a boolean indicating if the animation is running
  178. */
  179. animate(elapsedTimeSinceAnimationStart: number, from: number, to: number, loop: boolean, speedRatio: number, weight?: number): boolean;
  180. }