We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm using a preload screen to wait for my assets to load in my sketch and....
I'd like to have a button element on the id="p5_loading" screen that is greyed out and becomes avail for clicking once everything is loaded.
I want the user to click that button in order to "enter site" aka run setup.
Is that possible?
Answers
Possibly not - in the literal sense. If you're using preload() I see no callback function that gets run when loading of assets completes; so you've got nothing to hook into there. It looks like it goes straight through to setup() and then into draw... So you've got no way to literally pause execution.
Of course there's nothing to stop you giving the user the impression they're setting everything off; and in fact waiting for user input before anything actually happens in draw. I'm new to P5 (but not JavaScript); but you have the ability to inject the sketch into a named div; so you could:
thanks!
You can't pause execution of setup, but you could create another function that does what you would want to do in setup, and sets a boolean variable to put the sketch in a "running" state. Something like this:
Nice, Lauren. Thanks!