[p5.js 2.0 Bug Report]: Gifs don't work in WebGL mode

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

2.2

Web browser and version

All

Operating system

All

Steps to reproduce this

Steps:

  1. Create a webgl canvas
  2. Load a gif
  3. Draw it to the screen
    Oops! throws an error because this is undefined.

This is 100% my doing when refactoring WebGPU mode, I guess we have no test coverage on webgl + gifs. So I'll add a test when I fix this!

Snippet:

let gif
async function setup() {
  createCanvas(400, 400, WEBGL);
  gif = await loadImage('underconstruction.gif')
}

function draw() {
  background(220)
  imageMode(CENTER)
  image(gif, 0, 0)
}

Live: https://editor.p5js.org/davepagurek/sketches/KScRWKeVI