animationFrame.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { AnimationFrameScheduler } from './AnimationFrameScheduler';
  2. /**
  3. *
  4. * Animation Frame Scheduler
  5. *
  6. * <span class="informal">Perform task when `window.requestAnimationFrame` would fire</span>
  7. *
  8. * When `animationFrame` scheduler is used with delay, it will fall back to {@link asyncScheduler} scheduler
  9. * behaviour.
  10. *
  11. * Without delay, `animationFrame` scheduler can be used to create smooth browser animations.
  12. * It makes sure scheduled task will happen just before next browser content repaint,
  13. * thus performing animations as efficiently as possible.
  14. *
  15. * ## Example
  16. * Schedule div height animation
  17. * ```ts
  18. * // html: <div style="background: #0ff;"></div>
  19. * import { animationFrameScheduler } from 'rxjs';
  20. *
  21. * const div = document.querySelector('div');
  22. *
  23. * animationFrameScheduler.schedule(function(height) {
  24. * div.style.height = height + "px";
  25. *
  26. * this.schedule(height + 1); // `this` references currently executing Action,
  27. * // which we reschedule with new state
  28. * }, 0, 0);
  29. *
  30. * // You will see a div element growing in height
  31. * ```
  32. *
  33. * @static true
  34. * @name animationFrame
  35. * @owner Scheduler
  36. */
  37. export declare const animationFrame: AnimationFrameScheduler;