Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | import { AnimationFrameAction } from './AnimationFrameAction';
|
---|
2 | import { AnimationFrameScheduler } from './AnimationFrameScheduler';
|
---|
3 |
|
---|
4 | /**
|
---|
5 | *
|
---|
6 | * Animation Frame Scheduler
|
---|
7 | *
|
---|
8 | * <span class="informal">Perform task when `window.requestAnimationFrame` would fire</span>
|
---|
9 | *
|
---|
10 | * When `animationFrame` scheduler is used with delay, it will fall back to {@link asyncScheduler} scheduler
|
---|
11 | * behaviour.
|
---|
12 | *
|
---|
13 | * Without delay, `animationFrame` scheduler can be used to create smooth browser animations.
|
---|
14 | * It makes sure scheduled task will happen just before next browser content repaint,
|
---|
15 | * thus performing animations as efficiently as possible.
|
---|
16 | *
|
---|
17 | * ## Example
|
---|
18 | * Schedule div height animation
|
---|
19 | * ```ts
|
---|
20 | * // html: <div style="background: #0ff;"></div>
|
---|
21 | * import { animationFrameScheduler } from 'rxjs';
|
---|
22 | *
|
---|
23 | * const div = document.querySelector('div');
|
---|
24 | *
|
---|
25 | * animationFrameScheduler.schedule(function(height) {
|
---|
26 | * div.style.height = height + "px";
|
---|
27 | *
|
---|
28 | * this.schedule(height + 1); // `this` references currently executing Action,
|
---|
29 | * // which we reschedule with new state
|
---|
30 | * }, 0, 0);
|
---|
31 | *
|
---|
32 | * // You will see a div element growing in height
|
---|
33 | * ```
|
---|
34 | */
|
---|
35 | export const animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * @deprecated renamed. Use {@link animationFrameScheduler}
|
---|
39 | */
|
---|
40 | export const animationFrame = animationFrameScheduler;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.