processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.73k stars 3.34k forks source link

noLoop() not honored by saveGif() #7354

Open gohai opened 4 weeks ago

gohai commented 4 weeks ago

Most appropriate sub-area of p5.js?

p5.js version

1.11.0

Web browser and version

130.0.6723.92

Operating system

macOS

Steps to reproduce this

Steps:

  1. Run the snippet below

Snippet:

function setup() {
  createCanvas(400, 400);
  saveGif('mySketch', 5, { units: "frames" });
  noLoop();
}

function draw() {
  background(220);
  console.log("draw");
}

It'd be great to have the ability to create animated Gifs from graphics that aren't possible to create real-time (e.g. because each frame requires a web API call, which takes multiple seconds to complete). p5's redraw() function would be great for this to use (i.e. this invokes draw whenever a frame is ready to be added to the animation). Unfortunately, the current implementation of saveGif() does not seem to honor noLoop() - as the draw function is called periodically regardless.

welcome[bot] commented 4 weeks ago

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!