Path.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import { Vector2 } from './../../math/Vector2';
  2. import { CurvePath } from './CurvePath';
  3. export enum PathActions {
  4. MOVE_TO,
  5. LINE_TO,
  6. QUADRATIC_CURVE_TO, // Bezier quadratic curve
  7. BEZIER_CURVE_TO, // Bezier cubic curve
  8. CSPLINE_THRU, // Catmull-rom spline
  9. ARC, // Circle
  10. ELLIPSE,
  11. }
  12. export interface PathAction {
  13. action: PathActions;
  14. args: any;
  15. }
  16. /**
  17. * a 2d path representation, comprising of points, lines, and cubes, similar to the html5 2d canvas api. It extends CurvePath.
  18. */
  19. export class Path extends CurvePath<Vector2> {
  20. constructor( points?: Vector2[] );
  21. currentPoint: Vector2;
  22. /**
  23. * @deprecated Use {@link Path#setFromPoints .setFromPoints()} instead.
  24. */
  25. fromPoints( vectors: Vector2[] ): void;
  26. setFromPoints( vectors: Vector2[] ): void;
  27. moveTo( x: number, y: number ): void;
  28. lineTo( x: number, y: number ): void;
  29. quadraticCurveTo( aCPx: number, aCPy: number, aX: number, aY: number ): void;
  30. bezierCurveTo(
  31. aCP1x: number,
  32. aCP1y: number,
  33. aCP2x: number,
  34. aCP2y: number,
  35. aX: number,
  36. aY: number
  37. ): void;
  38. splineThru( pts: Vector2[] ): void;
  39. arc(
  40. aX: number,
  41. aY: number,
  42. aRadius: number,
  43. aStartAngle: number,
  44. aEndAngle: number,
  45. aClockwise: boolean
  46. ): void;
  47. absarc(
  48. aX: number,
  49. aY: number,
  50. aRadius: number,
  51. aStartAngle: number,
  52. aEndAngle: number,
  53. aClockwise: boolean
  54. ): void;
  55. ellipse(
  56. aX: number,
  57. aY: number,
  58. xRadius: number,
  59. yRadius: number,
  60. aStartAngle: number,
  61. aEndAngle: number,
  62. aClockwise: boolean,
  63. aRotation: number
  64. ): void;
  65. absellipse(
  66. aX: number,
  67. aY: number,
  68. xRadius: number,
  69. yRadius: number,
  70. aStartAngle: number,
  71. aEndAngle: number,
  72. aClockwise: boolean,
  73. aRotation: number
  74. ): void;
  75. }
粤ICP备19079148号