Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p5.js 2.0 🙏 P5LIVE #7537

Open
2 tasks
ffd8 opened this issue Feb 11, 2025 · 2 comments
Open
2 tasks

p5.js 2.0 🙏 P5LIVE #7537

ffd8 opened this issue Feb 11, 2025 · 2 comments

Comments

@ffd8
Copy link
Contributor

ffd8 commented Feb 11, 2025

p5.js 2.0 🙏 P5LIVE

Thread to discuss issues implementing v2.0 within P5LIVE, a live-coding fullscreen editor for p5.js.

Testing

Can install offline mode or use online.
To force 2.0, add the following snippet to very top of sketch, which disables p5, loads an external library, then inits p5:

/* manually load p5.js - v2.0 beta*/
// no p5
let libs = ['https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.min.js']
new p5()

Can also replace the p5.js file in offline mode which is held in /includes/p5/p5.min.js.

WARNING: when digging under hood with offline mode, P5LIVE is a beast of spaghetti code in one file to win them all(!) = my poetic learning JS over the years.. it works.. it's beautiful to me, maybe ugly to others.. likely tricky to parse - so be it... main concept – all code runs within a sandboxed iframe – code from editor is joined with the libs, and passed into the <body> of /includes/templates/p5live_sketch.html doc.

Issues

  • draw() doesn't make it past 1 frameCount cycle
    • what changed under hood to cause that??
  • FES complains about overwriting global vars (frameCount / mouseX / mouseY / pmouseX / pmouseY)
    • is this global-overwrite FES necessary? floods console on every recompile (unless manually filtered).

Future Planning

  • default version is 1.0+ until _____ then 2.0?
    • how to deal with loading pre-2.0 files?
    • only mod-dated files after switch default to 2.0?
  • JSON style settings at top of sketch to custom load version of p5, ie let p5liveSettings = {version:'2.0.0'}, which uses CDN for online mode and offline potentially uses node fs to once download custom version if needed.
@ffd8 ffd8 added the p5.js 2.0 label Feb 11, 2025
@ffd8 ffd8 changed the title [p5.js 2.0 Beta Bug Report]: P5LIVE issues p5.js v2.0 🙏 P5LIVE Feb 11, 2025
@ffd8 ffd8 changed the title p5.js v2.0 🙏 P5LIVE p5.js 2.0 🙏 P5LIVE Feb 11, 2025
@limzykenneth
Copy link
Member

For the FES, we have some ideas to help make your use case work but in the meantime, disabling FES should make the messages go away. Do let us know if that's not the case though.

For draw() not advancing I'll need to investigate deeper. I'm not familiar with P5Live's code but if you have some idea around what kind of hook P5Live uses/modify from p5 in relation to the animation loop, it would be helpful for me to narrow things down quicker.

@limzykenneth
Copy link
Member

@ffd8 I just had a test of P5Live locally with p5.js 2.0 beta 3 and am I right in saying that it is just the values of mouseX/Y, pmouseX/Y and frameCount being incorrect while the sketch and draw loop itself is still working? I was under the impression that the problem is the draw loop not advancing after 1 frame but I may have misunderstood and it is just the frameCount not advancing?

If that is the problem and not the draw loop not running, I'll need to think about how to enable this overriding of instance value here, but if there is another issue that I'm not noticing here do let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants