u(t) is called 60 times per second.
t: Elapsed time in seconds.
S: Shorthand for Math.sin.
C: Shorthand for Math.cos.
T: Shorthand for Math.tan.
R: Function that generates rgba-strings, usage ex.: R(255, 255, 255, 0.5)
c: A 1920x1080 canvas.
x: A 2D context for that canvas.
just have your y movement be a function of x -> w=c.width=1920;N=70;for(j=3e3;j--;x.fillRect(X+4*(X/120*Y/100)+90,Y+X*.1*S(X/N-7*t)+55,9,9))X=(j%N)*15,Y=((j/N)^0)*15 x.fillRect(N,50,9,w)
u(t) is called 60 times per second.
t: elapsed time in seconds.
c: A 1920x1080 canvas.
x: A 2D context for that canvas.
S: Math.sin
C: Math.cos
T: Math.tan
R: Generates rgba-strings, ex.: R(255, 255, 255, 0.5)