Why libraries work smoother than the vanilla code?

It is noticed that third-party Bible work much smoother and nicer than if you realizovyvat similar functionality vanilla simple code.

For example, rellax and parallax.js running smoothly than it is to write this functionality yourself.

Question - why is this happening? They catch some events, do something else for the effectiveness of animations?
June 14th 19 at 20:33
1 answer
June 14th 19 at 20:35
Solution
It is difficult to answer this question if I don't know how you did your version.
Have you used easing, throttle/debounce, requestAnimationFrame, and all that.
No, nothing just a replacement translate depending on scroll/cursor position. - lesly_Lindgren commented on June 14th 19 at 20:38
Is in General not particularly difficult, all of these things fit into a few hundred rows. Implementation examples are easily found. - Austen.Thompson53 commented on June 14th 19 at 20:41
so I'm not about that. Why do I need a couple of hundred rows if the parallax is done in 10 lines. The hundreds needed for what? easing, throttle/debounce, requestAnimationFrame? They optimize something? I'm not asking how to do parallax and its slognosti. I do not understand why Bible work differently. - lesly_Lindgren commented on June 14th 19 at 20:44
, easing smoothing. throttle/debounce and requestAnimationFrame - optimization. - Austen.Thompson53 commented on June 14th 19 at 20:47
understood. this is the case when more complicated is better. If a couple of hundred lines - it means that it is easier to use already ready Bible. Thank you! - lesly_Lindgren commented on June 14th 19 at 20:50

Find more questions by tags JavaScript