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.
also whenever the order of execution isn't important you can shorten for loops like this: for(i=100;i--;); becaus 0 is falsy, so when i reaches 0 the loop exits
you an free up space, so you can center the Explotion like this: c.width=640,x.translate(320,180);for(i=99;i--;)for(z=99;z--;x.rotate(.12))x.fillRect(z*t+S(t)*10,i*t+C(t),2*S(i),5*S(z))
this example adds some additional golfhing tricks: 99 is almost 100 :-), use the free slot in the for loop to execute code, you would otherwise execute inside the for loop
Thanks a lot danny! I'm new on this so really appreciate the comments.
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)