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

feat/ Loading Screen #49

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

feat/ Loading Screen #49

wants to merge 6 commits into from

Conversation

jchailatte
Copy link

resolves #9

Let me know if anything needs to be changed.

Comment on lines 24 to 27
<Suspense fallback={<Ready setReady={setReady} />}>{children}</Suspense>
<div className={`fullscreen bg ${ready ? 'ready' : 'notready'} ${clicked && 'clicked'}`}>
{!ready ? <Loader /> :
<>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping to make use of the useProgress hook from https://github.com/pmndrs/drei

and the loader should replace Ready

Suggested change
<Suspense fallback={<Ready setReady={setReady} />}>{children}</Suspense>
<div className={`fullscreen bg ${ready ? 'ready' : 'notready'} ${clicked && 'clicked'}`}>
{!ready ? <Loader /> :
<>
<Suspense fallback={<Loader setReady={setReady} />}>{children}</Suspense>
<div className={`fullscreen bg ${ready ? 'ready' : 'notready'} ${clicked && 'clicked'}`}>
<div className="stack">

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, yeah I can do that

Copy link
Author

@jchailatte jchailatte Jun 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I just implemented the loading screen as a fallback so the loading screen now appears after 'Click to continue' is pressed (it will show for maybe a second or two max). Is this what you wanted?

Edit: The loading will pretty much be at or close to 100% by the time the user clicks also.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that sounds about correct, it's just to make sure everything is loaded by the time the user wants to view the scene.. as a fallback

useEffect(() => () => void setReady(true), [])
return null
function Ready() {
const { progress } = useProgress()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want ready to be set as true when progress is complete

Suggested change
const { progress } = useProgress()
const { progress } = useProgress()
useEffect(() => {
if(progress !== 100) { return }
setReady(true)
}, [progress])

Copy link
Author

@jchailatte jchailatte Jun 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I added setReady back along with the other stuff that conditionally rendered based on ready. I'm curious as to why the ready state is preferred since it seems like the loading screen will never be triggered or is that the point?

@drcmda
Copy link
Member

drcmda commented Jun 5, 2021

Does this show the keys like the current loading screen, I think that would be nice. Basically just giving it a background image and some styles?

I would build on the current one that has all the poimandres info. Maybe even just use progress + image

@jchailatte
Copy link
Author

jchailatte commented Jun 5, 2021

Does this show the keys like the current loading screen, I think that would be nice. Basically just giving it a background image and some styles?

I would build on the current one that has all the poimandres info. Maybe even just use progress + image

No, this is currently a separate loading page that will display between the keys and the scene as a fallback.
Looks like this
Edit: It would be very easy to just make this as a background to the current loading page though
image

@drcmda
Copy link
Member

drcmda commented Jun 5, 2021

maybe we should do something more stylized. we have a blender file that could be rendered out in a really fancy way. we can play around with some variants before committing.

@drcmda
Copy link
Member

drcmda commented Jun 5, 2021

ive added useprogress to the black loading screen. we could leave this open and collect ideas for some replacement.

@njm222 njm222 marked this pull request as draft June 8, 2021 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui: loader / loading screen
3 participants