Angular πŸ‡ΊπŸ‡¦ - practical notes
1.63K subscribers
1.6K photos
1 file
532 links
Angular - practical notes

This group is for posting practical notes for Angular developers. Mostly all posts are for quick implementation https://t.me/angular_practical_notes (Commenting on posts only in ENG and UA langs here). Welcome!
Download Telegram
πŸ“„ animationFrameScheduler example

#angular #rxjs #animationFrameScheduler

animationFrameScheduler is tailored for tasks that require synchronization with the browser's animation frame. It schedules tasks to be executed just before the next animation frame, ensuring smooth animations and minimizing unnecessary computations. For instance, we can utilize the animationFrameScheduler to update the UI based on animation frames, creating a visually pleasing and responsive user interface.

The scrollPosition$ observable captures the scroll position of the window on each scroll event. The animationFrameScheduler is used to ensure that the scroll position updates and smooth scrolling effect occur right before each animation frame, providing a visually smooth scrolling experience. When the user clicks the "scroll to top" button, the scrollPosition$ observable is subscribed to, and the window is scrolled smoothly towards the top in increments of 10 pixels until the scroll position reaches 0.

βœ… Article Link: https://priyank-bhardwaj.medium.com/reactive-ninja-harnessing-rxjs-for-angular-mastery-part-2-7091aac29d60