processing / p5.js-web-editor

The p5.js Editor is a website for creating p5.js sketches, with a focus on making coding accessible and inclusive for artists, designers, educators, beginners, and anyone else! You can create, share, or remix p5.js sketches without needing to download or configure anything.
https://editor.p5js.org
GNU Lesser General Public License v2.1
1.3k stars 1.26k forks source link

"Real" Live Coding / Dumb Live Reloading / Accessing Editor State from user scripts #3087

Open TiborUdvari opened 2 months ago

TiborUdvari commented 2 months ago

Increasing Access

Hello,

I'm currently working on p5.xr, and I would like to share examples with the web editor. Because of how WebXR works, the user has to press a button to give access to an immersive session. Entering this mode takes a few seconds and it's quite cumbersome to have to go in and out of the mode to change simple parameters.

I would like to have a "real live coding" experience, as with p5.live, as you can see below. I don't want to use p5.live, because the sharing functionality is not working as well as with the web editor for now.

https://github.com/processing/p5.js-web-editor/assets/1434442/da8f46f0-8fb5-4d4c-8eee-765e35830cf0

Feature request details

As mentioned in #3 currently the page reloads completely on changes. Having a live mode would entail only reloading parts of the sketch.

For my use case at least, a quick and imperfect way to prototype is all I need. I know that having this work "properly" would involve handling a lot of edge cases and could be quite tricky.

I made a simple script today that works fine locally: https://github.com/TiborUdvari/p5.dumbLiveReload/blob/main/src/index.js. I'm using a polling approach, which works fine on my localhost, but I think that could be problematic with the web editor.

I've quickly checked the networking in the editor, and on save there seems to be a PUT request that sends all the data to the server.

My questions, to be able to make this work properly with the editor would be:

Thanks a lot!

welcome[bot] commented 2 months ago

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

Faizan-Alam-1 commented 2 months ago

Not everyone has a VR headset. Only a few people are able to take advantage of this feature.

TiborUdvari commented 2 months ago

I don't completely agree. This can be useful for any feature that requires an expensive initial setup:

This is the whole raison d'être of p5.live. I think a minimal MVP version in the editor could be a nice feature a lot of folks with different use cases can benefit from.