When I comment on this line:
setTimeout(function(){float(!dir)}, 0);
the element stops moving exactly on the line marked It skips here
.
It seems that when resetting the movement to // avoid exceeding stack
it resets the position of the element to y = 0, while preserving the x value of the element, as well as its path of movement.
This hypothesis is further confirmed by the fact that when a slip occurs (somewhere on the y axis), the element always resumes its movement from y = 0. Sometimes its value of y is> y = 0, while sometimes it is equal to <y = 0 - such Thus, a random search "skips".
Edit
Returning to the original sinus demo , it seems like you can get closer to infinite scrolling by manipulating the line x= ...
After some have looked at the original source, it seems that the demo version of the script was written only to solve one specific example and fixed-width problems.
Here is a working example.
By manipulating the numbers in lines 1 and 2, you can specify the number of pixels for the path you want to go to and slow down the path down in line 3 to make it the same speed as the original demo. So, not mathematically endlessly, but it took my computer 45 seconds. By controlling these specific lines, you can make it βendlessβ as you need.
window.SineWave = SineWave = function() { this.css = function(p) { s = Math.sin((p-1)*500);
source share