Clip.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { AnimationEasing } from './easing';
  2. import type Animation from './Animation';
  3. declare type OnframeCallback = (percent: number) => void;
  4. declare type ondestroyCallback = () => void;
  5. declare type onrestartCallback = () => void;
  6. export declare type DeferredEventTypes = 'destroy' | 'restart';
  7. export interface ClipProps {
  8. life?: number;
  9. delay?: number;
  10. loop?: boolean;
  11. easing?: AnimationEasing;
  12. onframe?: OnframeCallback;
  13. ondestroy?: ondestroyCallback;
  14. onrestart?: onrestartCallback;
  15. }
  16. export default class Clip {
  17. private _life;
  18. private _delay;
  19. private _inited;
  20. private _startTime;
  21. private _pausedTime;
  22. private _paused;
  23. animation: Animation;
  24. loop: boolean;
  25. easing: AnimationEasing;
  26. easingFunc: (p: number) => number;
  27. next: Clip;
  28. prev: Clip;
  29. onframe: OnframeCallback;
  30. ondestroy: ondestroyCallback;
  31. onrestart: onrestartCallback;
  32. constructor(opts: ClipProps);
  33. step(globalTime: number, deltaTime: number): boolean;
  34. pause(): void;
  35. resume(): void;
  36. setEasing(easing: AnimationEasing): void;
  37. }
  38. export {};