FileSaver.js + ffmpeg
FilSaver.js PNG: BLOB-
PNG ffmpeg : FFmpeg?
Chromium 75 , . , "", , 0.png, 1.png ..
Firefox 68, , " ". " ", "Enter", !
, JavaScript.
var canvas = document.getElementById("my-canvas");
var ctx = canvas.getContext("2d");
var pixel_size = 1;
var t = 0;
function createBlobFunc(t) {
return function(blob) {
saveAs(blob, t.toString() + '.png');
};
}
function draw() {
console.log("draw");
for (x = 0; x < canvas.width; x += pixel_size) {
for (y = 0; y < canvas.height; y += pixel_size) {
var b = ((1.0 + Math.sin(t * Math.PI / 16)) / 2.0);
ctx.fillStyle =
"rgba(" +
(x / canvas.width) * 255 + "," +
(y / canvas.height) * 255 + "," +
b * 255 +
",255)"
;
ctx.fillRect(x, y, pixel_size, pixel_size);
}
}
canvas.toBlob(createBlobFunc(t));
t++;
window.requestAnimationFrame(draw);
}
window.requestAnimationFrame(draw);
<canvas id="my-canvas" width="512" height="512" style="border:1px solid black;"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.min.js"></script>
Hide resultGitHub upstream.
GIF, : https://askubuntu.com/questions/648244/how-do-i-create-an-animated-gif-from-still-images-preferably-with-the-command-l

, FPS
, , . 32x32 Chromium 77 10 50 ...
, ... FileSaver.js
, , , ... requestAnimationFrame? : https://cirosantilli.com/#html-canvas
, - :
!
Here is the version of OpenGL if you decide that the browser is not for you :-) How to use GLUT / OpenGL to render to a file?
Tested on Ubuntu 19.04.
source
share