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.
Took some hints from d/11257 for the fire, but made it more minimal. Thanks to u/KilledByAPixel for the c.width&= trick that allowed to fit some nicer gradient and fire effect.
This is a bit verbose, but I found it easier to understand in binary: 1920 == 0b0000011110000000; 8320 == (8192 | 128); 8320 == 0b0010000010000000; (1920 & 8320) == 0b0000000010000000. In other words i needs to be roughly 8e3 to fill the screen, 8192 (the 14th bit) is not in 1920 so we can use it without affecting w. w needs to be quite small, 128 (the 8th bit) is the lowest bit available in 1920, which is why it's produced with AND.
Ok why not, I will do writeup, but need to make blog first :P I will post here and discord when done.
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)