From 21f5e3db573cad9ef4a00821a5468b31549656a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Enrique=20Rasc=C3=B3n?= Date: Sun, 19 Jun 2022 11:43:05 +0200 Subject: [PATCH 1/4] update documentation --- src/image/image.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/image/image.js b/src/image/image.js index 8260776c13..c38a645c8f 100644 --- a/src/image/image.js +++ b/src/image/image.js @@ -420,15 +420,20 @@ p5.prototype.saveGif = function(pImg, filename) { * as an argument to the callback function as an array of objects, with the * size of array equal to the total number of frames. * - * Note that saveFrames() will only save the first 15 frames of an animation. + * Note that saveFrames() will only save the first 15 seconds of an animation. + * The arguments `duration` and `framerate` are constrained to be less or equal 15 and 22, respectively, which means you + * can only download a maximum of 15 seconds worth of frames at 22 frames per second, adding up to 330 frames. + * This is done in order to avoid memory problems since a large enough canvas can fill up the memory in your computer + * very easily and crash your program or even your browser. + * * To export longer animations, you might look into a library like * ccapture.js. * * @method saveFrames * @param {String} filename * @param {String} extension 'jpg' or 'png' - * @param {Number} duration Duration in seconds to save the frames for. - * @param {Number} framerate Framerate to save the frames in. + * @param {Number} duration Duration in seconds to save the frames for. This parameter will be constrained to be less or equal to 15. + * @param {Number} framerate Framerate to save the frames in. This parameter will be constrained to be less or equal to 22. * @param {function(Array)} [callback] A callback function that will be executed to handle the image data. This function should accept an array as argument. The From a0a151a6b51a0bdd7ddd4599659a602b24e8e9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Enrique=20Rasc=C3=B3n?= Date: Sun, 19 Jun 2022 11:43:30 +0200 Subject: [PATCH 2/4] fix linter error --- src/image/image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/image/image.js b/src/image/image.js index c38a645c8f..0b329f01cb 100644 --- a/src/image/image.js +++ b/src/image/image.js @@ -69,7 +69,7 @@ import omggif from 'omggif'; * let img = createImage(66, 66); * img.loadPixels(); * let d = pixelDensity(); - * let halfImage = 4 * (img.width * d) * (img.height / 2 * d); + * let halfImage = 4 * (img.width * d) * ((img.height / 2) * d); * for (let i = 0; i < halfImage; i += 4) { * img.pixels[i] = red(pink); * img.pixels[i + 1] = green(pink); From 1a9ae6b874e43023183cc8539046055cc062b64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Enrique=20Rasc=C3=B3n?= Date: Fri, 1 Jul 2022 19:07:11 +0200 Subject: [PATCH 3/4] fix linter error --- src/image/image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/image/image.js b/src/image/image.js index 0b329f01cb..c38a645c8f 100644 --- a/src/image/image.js +++ b/src/image/image.js @@ -69,7 +69,7 @@ import omggif from 'omggif'; * let img = createImage(66, 66); * img.loadPixels(); * let d = pixelDensity(); - * let halfImage = 4 * (img.width * d) * ((img.height / 2) * d); + * let halfImage = 4 * (img.width * d) * (img.height / 2 * d); * for (let i = 0; i < halfImage; i += 4) { * img.pixels[i] = red(pink); * img.pixels[i + 1] = green(pink); From 980811887a4b8bc0536f795d6966a1d37854e755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Enrique=20Rasc=C3=B3n?= Date: Fri, 1 Jul 2022 22:41:11 +0200 Subject: [PATCH 4/4] remove redundant information and fix typo --- src/image/image.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/image/image.js b/src/image/image.js index c38a645c8f..8ac3a24bba 100644 --- a/src/image/image.js +++ b/src/image/image.js @@ -420,8 +420,7 @@ p5.prototype.saveGif = function(pImg, filename) { * as an argument to the callback function as an array of objects, with the * size of array equal to the total number of frames. * - * Note that saveFrames() will only save the first 15 seconds of an animation. - * The arguments `duration` and `framerate` are constrained to be less or equal 15 and 22, respectively, which means you + * The arguments `duration` and `framerate` are constrained to be less or equal to 15 and 22, respectively, which means you * can only download a maximum of 15 seconds worth of frames at 22 frames per second, adding up to 330 frames. * This is done in order to avoid memory problems since a large enough canvas can fill up the memory in your computer * very easily and crash your program or even your browser.