timeline.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import * as d3Timer from 'd3-timer';
  2. import { ICanvas, IElement } from '../interfaces';
  3. declare class Timeline {
  4. /**
  5. * 画布
  6. * @type {ICanvas}
  7. */
  8. canvas: ICanvas;
  9. /**
  10. * 执行动画的元素列表
  11. * @type {IElement[]}
  12. */
  13. animators: IElement[];
  14. /**
  15. * 当前时间
  16. * @type {number}
  17. */
  18. current: number;
  19. /**
  20. * 定时器
  21. * @type {d3Timer.Timer}
  22. */
  23. timer: d3Timer.Timer;
  24. /**
  25. * 时间轴构造函数,依赖于画布
  26. * @param {}
  27. */
  28. constructor(canvas: ICanvas);
  29. /**
  30. * 初始化定时器
  31. */
  32. initTimer(): void;
  33. /**
  34. * 增加动画元素
  35. */
  36. addAnimator(shape: any): void;
  37. /**
  38. * 移除动画元素
  39. */
  40. removeAnimator(index: any): void;
  41. /**
  42. * 是否有动画在执行
  43. */
  44. isAnimating(): boolean;
  45. /**
  46. * 停止定时器
  47. */
  48. stop(): void;
  49. /**
  50. * 停止时间轴上所有元素的动画,并置空动画元素列表
  51. * @param {boolean} toEnd 是否到动画的最终状态,用来透传给动画元素的 stopAnimate 方法
  52. */
  53. stopAllAnimations(toEnd?: boolean): void;
  54. /**
  55. * 获取当前时间
  56. */
  57. getTime(): number;
  58. }
  59. export default Timeline;