How to fix animation performance?

Such cases.

There is code of animation:
if ( $('.landing__superdesign').length ) {
 let f = $('.landing__superdesign-f');
 let s = $('.landing__superdesign-s');
 let t = $('.landing__superdesign-t');

 let parallax = () => {
 let scrollTop = $('.wrap').scrollTop();
 f.css('transform', 'translateY(' + scrollTop/10 + 'px)');
 s.css('transform', 'translateY(' + -scrollTop/10 + 'px)');
 t.css('transform', 'rotate(' + (45 + scrollTop/10) + 'deg)');
window.requestAnimationFrame(parallax);
};
window.requestAnimationFrame(parallax);
 }

three elements, two move vertically, one spinning on its axis (elements - basic shapes: two rectangles and line)

But once I start to scroll the page, the MacBook cuts a cooler, and heats the page slightly podlagivaet.
In addition to this the animation is almost the same only for background images - it moves horizontally with backgriund-position. No animated figures page no frieze, with figures for the pain begins.

What is wrong and how to facilitate animation?
June 14th 19 at 20:06
1 answer
June 14th 19 at 20:08
Solution
Why do 60 times a second to turn this function? Can not hang on any event, scroll or the like? Parameters that do not seem to change.
Type this
Yes, bač, thank you)
I would have done if a couple of weeks ago tried requestAnimation and saw how much it facilitates animation, but there's something not specified) - Durward_Osinski commented on June 14th 19 at 20:11
voiced it is possible to implement and using requestAnimationFrame, I'm in the last question about the animation already told you how to do it, even the code was sent. Another thing is that if your algorithm is not optimal, then the page will still slow down, just not permanently, but only while scrolling. Or are you saying that does not slow down? - gustave_Kertzmann52 commented on June 14th 19 at 20:14
, requestAnimation is nice, but you need to understand where it is properly applied. Another thing is if these objects were permanently twisted and flew on the site, and if the settings don't change themselves, nothing is calculated, then you should not use this method. - Alene56 commented on June 14th 19 at 20:17

Find more questions by tags FrontendAnimationJavaScript