pathCursor.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { Vector3 } from "../Maths/math.vector";
  2. import type { Path2 } from "../Maths/math.path";
  3. /**
  4. * A cursor which tracks a point on a path
  5. */
  6. export declare class PathCursor {
  7. private _path;
  8. /**
  9. * Stores path cursor callbacks for when an onchange event is triggered
  10. */
  11. private _onchange;
  12. /**
  13. * The value of the path cursor
  14. */
  15. value: number;
  16. /**
  17. * The animation array of the path cursor
  18. */
  19. animations: Animation[];
  20. /**
  21. * Initializes the path cursor
  22. * @param _path The path to track
  23. */
  24. constructor(_path: Path2);
  25. /**
  26. * Gets the cursor point on the path
  27. * @returns A point on the path cursor at the cursor location
  28. */
  29. getPoint(): Vector3;
  30. /**
  31. * Moves the cursor ahead by the step amount
  32. * @param step The amount to move the cursor forward
  33. * @returns This path cursor
  34. */
  35. moveAhead(step?: number): PathCursor;
  36. /**
  37. * Moves the cursor behind by the step amount
  38. * @param step The amount to move the cursor back
  39. * @returns This path cursor
  40. */
  41. moveBack(step?: number): PathCursor;
  42. /**
  43. * Moves the cursor by the step amount
  44. * If the step amount is greater than one, an exception is thrown
  45. * @param step The amount to move the cursor
  46. * @returns This path cursor
  47. */
  48. move(step: number): PathCursor;
  49. /**
  50. * Ensures that the value is limited between zero and one
  51. * @returns This path cursor
  52. */
  53. private _ensureLimits;
  54. /**
  55. * Runs onchange callbacks on change (used by the animation engine)
  56. * @returns This path cursor
  57. */
  58. private _raiseOnChange;
  59. /**
  60. * Executes a function on change
  61. * @param f A path cursor onchange callback
  62. * @returns This path cursor
  63. */
  64. onchange(f: (cursor: PathCursor) => void): PathCursor;
  65. }