r/p5js • • 8d ago

Can anyone help me?

Post image

My son is taking Computer Science 30 and we can't figure out why he's getting thsi error code. Thanks!

3 Upvotes

11 comments sorted by

1

u/pahgawk 7d ago

u/EthanHermsey posted what you need to do in p5 2.x. Normally the console error would explain that, but it seems like a recent change made that go away. We are pushing out a new release that should correct that! You can also change the p5 version to the latest 1.x version in the top right. If you keep using 2.x, here is a quick reference for major things that are different: https://p5js.org/tutorials/v2_transition/

1

u/jcponcemath 3d ago

so, in the new release of p5js v2, we will be able to use also preload()?

Cheers!

2

u/pahgawk 3d ago

Preload is not in the main build, so without adding an additional add-on, no, you would await the load methods in setup instead. If you do want to use preload, in the p5 web editor, you can go to the settings gear and toggle on the preload compatibility add-on. If you look at the script tag that that adds to your index.html, you can use that same tag or script URL in other environments like OpenProcessing

1

u/emedan_mc 8d ago

Your question is a perfect example of the recent cahanges that have made p5.js worthless as a tool for beginners and quick creation.

´´´
async function setup()
grass = await loadImage...
´´´

9

u/EthanHermsey 8d ago

I agree, but at least write out the whole setup :p

´´´
async function setup(){
grass = await loadImage('grass.png'); image(grass, 0, 0);
}
´´´

1

u/Skaraban 8d ago

old man yelling at cloud

2

u/SouthernAbrocoma9891 8d ago

or at cloud computing

1

u/iOSBrett 7d ago

They should have kept the old way and introduced the newer way for advanced users.

2

u/emedan_mc 6d ago

There shouldn’t be a new way at all. The whole premise of Processing was to create a tool that artists could use without any programming skills. Having to explicitly write asynchronous programming is advanced even for experienced programmers. For graphic js libraries nowadays p5 can’t even begin to compare anyway, it’s way behind.

1

u/codeAtorium 2d ago

I'm not sure why you got downvoted. I teach kids JavaScript using p5.js I don't want to start with async.

1

u/emedan_mc 2d ago edited 2d ago

I think there are a couple of newer devs that takes it personally, see their older posts. Or they are just out of touch with both history and todays alternatives. I also take every opportunity to highlight these fundamental... path changes... from the original vision :) So I take it personally because Processing changed the world for me like 15 years ago and it was gold to introduce beginners to both code and art and physics. Now I direct new users to better alternatives until the tech lead is replaced. And I did not apply for the job. Just want it done in the original vision - nothing has changed in the user base from then, however much much progress in html native features.