Skip to content

noLoop() not honored by saveGif() #7354

Open
@gohai

Description

@gohai

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions