Skip to content

[p5.js 2.0 Beta Bug Report]: FES support for preload #7540

Closed
@aferriss

Description

@aferriss

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.0.0 beta 2

Web browser and version

Chrome 132.0.6834.111

Operating system

MacOSX Sequoia 15.2

Steps to reproduce this

I was wondering if there should be some FES message when trying to use a loading function within preload, or preload at all in 2.0. As it stands, things just fail silently and the preload function is never called. Maybe we can direct the user to some information about the new changes and how they might adapt their code to begin working again?

In p5 2.0, preload is no longer supported. In order to load assets you need to use the async and await keywords in the setup functions or use callbacks..... here's a link to learn more about the changes

Apologies if this is a duplicate issue, I saw some others but they seemed a little different ( #7533)

Steps:

  1. Call any loadX() function in preload
  2. Observe nothing happens.

Snippet:

let img;

// preload never called
function preload(){
   img = loadImage("test.jpg");
}

function setup(){
  createCanvas(100, 100);
}

function draw(){
}

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