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.
maybe something like this?: t?c.width=199:(ẏ=a=ẋ=1,y=X=12);y+=ẏ+=.12;ẏ*=y>99?a=-1:1;X+=ẋ*=X>179|X<12?-1:1;a*=.98;x.ellipse(X,y,4*a*C(ẏ)+9,4*a*S(ẏ)+9,0,0,7);x.fill()
was thinking like this (but this is to long) t?c.width|=0:e=f=d=a=1;a<0?a=0:a-=.2;d<5?a=20:0;b>1700?(f-=5,a=20):0;b<200?(f+=5,a=20):0;e+=f;x.ellipse(b=960+e,840-(d=Math.abs(500*S(t))),a*S(t*9)+200,a*C(t*9)+200,0,0,7);x.fill();
A lot of chars for a little change: t?c.width|=0:d=a=y=F=T=0;l=t-T+.087;y+=9*a;a-=.01;y<-28?(F||(F=T=t),l=.087+(t-T)/2,y=-28,b=40,l>.43?(a=1,y=28,F=0,T+=(t-T)/2):u):b=20*a+20;h=-b*S(l*9);x.ellipse(960,840-y-(y>0?0:h),200+b*S(l*9),200+h,0,0,7);x.fill()
20 months later, I got it bouncing off the walls, but not wobbling, in the remix
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)