8629c3a5ad7b8ff271db4145a4dcf4cc91b855a1a6661b152b8d8e82c135bf24d868e6998798da19ea66fd8c868253309eb5e56978743f89f26f1f902ff3df 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import Element, { ElementProps } from 'zrender/lib/Element.js';
  2. import { ZREasing } from './types.js';
  3. declare type AnimationWrapDoneCallback = () => void;
  4. /**
  5. * Animate multiple elements with a single done-callback.
  6. *
  7. * @example
  8. * animation
  9. * .createWrap()
  10. * .add(el1, {x: 10, y: 10})
  11. * .add(el2, {shape: {width: 500}, style: {fill: 'red'}}, 400)
  12. * .done(function () { // done })
  13. * .start('cubicOut');
  14. */
  15. declare class AnimationWrap {
  16. private _storage;
  17. private _elExistsMap;
  18. private _finishedCallback;
  19. /**
  20. * Caution: a el can only be added once, otherwise 'done'
  21. * might not be called. This method checks this (by el.id),
  22. * suppresses adding and returns false when existing el found.
  23. *
  24. * @return Whether adding succeeded.
  25. */
  26. add(el: Element, target: ElementProps, duration?: number, delay?: number, easing?: ZREasing): boolean;
  27. /**
  28. * Only execute when animation done/aborted.
  29. */
  30. finished(callback: AnimationWrapDoneCallback): AnimationWrap;
  31. /**
  32. * Will stop exist animation firstly.
  33. */
  34. start(): AnimationWrap;
  35. }
  36. export declare function createWrap(): AnimationWrap;
  37. export {};