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.
Feature request: When in fullscreen center the canvas and fill unused space with black. I'm guessing the white background is there in case the dweet has transparency. Would it be possible to put the canvas in a div with a white background and put a black background behind that?
It'd be nice but I don't have the room to add it to this dweet. I'm sure some dweets do that and so I tried to suggest a fix that wouldn't break that behavior.
For instance, d/6967. On my monitor the canvas does not extend to the bottom of the screen in fullscreen mode and there is a white bar running along the bottom. This makes the dweet look cut off. If it were a black bar it would look fine because the screen would just look dark there. This is how everything from TVs to YouTube deal with fullscreening when the source material that has a different aspect ratio from the screen.
Actually it looks like the canvases already their background color set to white (I had assumed that the background was not set and that setting it would change the rendering of some dweets, but it looks like that's not the case.) So you wouldn't even need the additional div that I suggested originally.
Nope, that's what I thought too. The image data within the canvas is initially transparent (this affects the rendering of dweets that call x.drawImage(c, ... ) but there is also a background css property on the canvas that is set to white and this causes transparent areas of the canvas to show up as white regardless of what's behind them. You can try this out by locally tweaking the css for the body element that contains the canvas. On most dweets you don't see any part of this element unless the dweet is fullscreened but there are exceptions like d/7084 . I don't know what the best way to handle that would be.
nice night sky with shooting stars. just incredible work
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)